Report

Expense Accounts

Shows a piechart with the Expenses per given time interval

A pie chart of the expense accounts' totals between two dates, largest first, with the smallest slices merged into Other. Use it to see where your money went. Each slice links to the report of its account. In GnuCash: Reports ▸ Income & Expense ▸ Expense Piechart.

The options that matter are Accounts/Accounts, Accounts/Levels of Subaccounts, General/Start Date and End Date and Display/Maximum Slices.

Examples

Example: with a copy of the reports/category-multi example book open as book.gnucash, at 2024-03-15T12:00:00Z.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"report.run","params":{"report":"Expense Accounts","options":{"Accounts":{"Accounts":["a0000000000000000000000000000001"]},"General":{"Start Date":{"absolute":"2024-03-01"},"End Date":{"absolute":"2024-03-31"}}}}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "title": "Expense Accounts",
    "sections": [
      {
        "blocks": [
          {
            "kind": "chart",
            "type": "pie",
            "title": [
              "Expense Accounts",
              "03/01/24 to 03/31/24: $496.00"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash report.run '{"report":"Expense Accounts","options":{"Accounts":{"Accounts":["a0000000000000000000000000000001"]},"General":{"Start Date":{"absolute":"2024-03-01"},"End Date":{"absolute":"2024-03-31"}}}}'

It prints:

{
  "title": "Expense Accounts",
  "sections": [
    {
      "blocks": [
        {
          "kind": "chart",
          "type": "pie",
          "title": [
            "Expense Accounts",
            "03/01/24 to 03/31/24: $496.00"
          ],
          "…": "…"
        },
        "…"
      ],
      "…": "…"
    },
    "…"
  ],
  "…": "…"
}

MCP tool call

Tool call:

{"name":"report.run","arguments":{"report":"Expense Accounts","options":{"Accounts":{"Accounts":["a0000000000000000000000000000001"]},"General":{"Start Date":{"absolute":"2024-03-01"},"End Date":{"absolute":"2024-03-31"}}}}}

Result:

{
  "structuredContent": {
    "title": "Expense Accounts",
    "sections": [
      {
        "blocks": [
          {
            "kind": "chart",
            "type": "pie",
            "title": [
              "Expense Accounts",
              "03/01/24 to 03/31/24: $496.00"
            ],
            "…": "…"
          },
          "…"
        ],
        "…": "…"
      },
      "…"
    ],
    "…": "…"
  }
}

Template GUID: 9bf1892805cb4336be6320fe48ce5446 · Script: standard/account-piecharts.rhai

Options

Accounts

  • Accounts (accountList, default []): Report on these accounts, if chosen account level allows.
  • Levels of Subaccounts (multichoice, default 2): Maximum number of levels in the account tree displayed.

Display

  • Show long names (boolean, default false): Show the full account name in legend?
  • Show Totals (boolean, default true): Show the total balance in legend?
  • Show Percents (boolean, default true): Show the percentage in legend?
  • Maximum Slices (numberRange, default 7): Maximum number of slices in pie.
  • Plot Width (plotSize, default {"percent":100}): Width of plot, 10 - 100 in percent, above in pixels.
  • Plot Height (plotSize, default {"percent":100}): Height of plot, 10 - 100 in percent, above in pixels.
  • Sort Method (multichoice, default "amount"): Choose the method for sorting accounts.

General

  • Report name (string, default "Expense Accounts"): Enter a descriptive name for this report.
  • Stylesheet (multichoice, default "Default"): Select a stylesheet for the report.
  • Add options summary (multichoice, default "never"): Add summary of options.
  • Start Date (date, default {"relative":"start-accounting-period"}): Start of reporting period.
  • End Date (date, default {"relative":"end-accounting-period"}): End of reporting period.
  • Report's currency (currency, default "CURRENCY::USD"): Select the currency to display the values of this report in.
  • Price Source (multichoice, default "pricedb-nearest"): The source of price information.
  • Show Average (multichoice, default "None"): Select whether the amounts should be shown over the full time period or rather as the average e.g. per month.