Monthly category report with selectable categories and time range?

Build and share your cool customized reports built w/ one sql, Chart.js and Lua

Moderator: Renato

DavidGreen
New MMEX User
Posts: 11
Joined: Fri Jul 03, 2020 2:28 pm
Are you a spam bot?: No

Monthly category report with selectable categories and time range?

Post by DavidGreen »

With cost of living increases, I'd like to monitor the trend of all my monthly spending in specific categories (like food), and see a chart over the past 6 or 12 months, say. Please can you suggest a report which allows me to select one or more categories to report, and the time period?

The closest I can find is the Monthly Categories report but its chart amalgamates all categories over the last 12 months, and shows data for every category.
The Monthly Income vs Expenses report contains exactly the Period and date selector I need, but has no category filter.

I have no experience of coding SQL and have not found anything similar to what I need in https://github.com/moneymanagerex/general-reports. When I have imported the CategoryTrend report, I don't even understand how to update category and subcategory!
dbolton
Super MMEX User
Posts: 126
Joined: Fri Jan 03, 2020 3:24 pm
Are you a spam bot?: No
Contact:

Re: Monthly category report with selectable categories and time range?

Post by dbolton »

The CategoryTrend report sounds like what you are looking for. It is set up to show Food:Groceries initially. Is that part working for you?

Although it isn't ideal, you can get different categories by editing one line of the SQL. Here's instructions to edit the category and subcategory.
  1. From the main menu, select Tools > General Report Manager.
  2. In the left pane, select Category-CategoryTrend.
  3. In the right pane, select the SQL tab.
  4. On line 35, replace the word 'Food' with the category you want to track: WHERE cat.CATEGNAME = 'Food'
  5. On line 35, replace the word 'Groceries' with the subcategory you want to track (or delete the second part, from 'AND' on, if you don't want to limit to a single subcategory): AND subcat.SUBCATEGNAME = 'Groceries'
  6. Select Save.
  7. Select Run.
DavidGreen
New MMEX User
Posts: 11
Joined: Fri Jul 03, 2020 2:28 pm
Are you a spam bot?: No

Re: Monthly category report with selectable categories and time range?

Post by DavidGreen »

Thanks for your clear instructions. After editing line 35 as you explain I can generate a Category Trend Report.

Is there any way to add a Period and date selector like I see in the Monthly Income vs Expenses report?

David Green
User avatar
Renato
MVP MMEX User
Posts: 655
Joined: Mon Apr 25, 2011 7:36 pm
Are you a spam bot?: No
Location: near Zurich

Re: Monthly category report with selectable categories and time range?

Post by Renato »

Probably this would be the solution: https://github.com/moneymanagerex/money ... ssues/4282
Renato Forum Administrator
dbolton
Super MMEX User
Posts: 126
Joined: Fri Jan 03, 2020 3:24 pm
Are you a spam bot?: No
Contact:

Re: Monthly category report with selectable categories and time range?

Post by dbolton »

You could insert the following lines immediately after line 35 of the SQL tab:

Code: Select all

	AND TRANSDATE >= '&begin_date'
	AND TRANSDATE <= '&end_date'
The selectable date range doesn't work in the Report Manager but if you Save and Close the manger then go to the report in the main window it shows a date range drop-down menu at the top.
DavidGreen
New MMEX User
Posts: 11
Joined: Fri Jul 03, 2020 2:28 pm
Are you a spam bot?: No

Re: Monthly category report with selectable categories and time range?

Post by DavidGreen »

Thank you dbolton.

Is there something similar I can do to add a category filter/selector?

D Green
DavidGreen
New MMEX User
Posts: 11
Joined: Fri Jul 03, 2020 2:28 pm
Are you a spam bot?: No

Re: Monthly category report with selectable categories and time range?

Post by DavidGreen »

dbolton wrote: Tue Apr 12, 2022 8:27 pm You could insert the following lines immediately after line 35 of the SQL tab:

Code: Select all

	AND TRANSDATE >= '&begin_date'
	AND TRANSDATE <= '&end_date'
The selectable date range doesn't work in the Report Manager but if you Save and Close the manger then go to the report in the main window it shows a date range drop-down menu at the top.
Before I add these lines the report generates a bar chart and data table, but after adding the lines the chart disappears and the data is empty.
trendBefore.png
trendBefore.png (115.11 KiB) Viewed 7610 times
trendAfter.png
trendAfter.png (46.64 KiB) Viewed 7610 times
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Monthly category report with selectable categories and time range?

Post by Nikolay »

Could you run the report from the Navigation tree?
DavidGreen
New MMEX User
Posts: 11
Joined: Fri Jul 03, 2020 2:28 pm
Are you a spam bot?: No

Re: Monthly category report with selectable categories and time range?

Post by DavidGreen »

This is the output from the Navigation tree.
User avatar
Renato
MVP MMEX User
Posts: 655
Joined: Mon Apr 25, 2011 7:36 pm
Are you a spam bot?: No
Location: near Zurich

Re: Monthly category report with selectable categories and time range?

Post by Renato »

for me it works with these lines:
.
where cat.CATEGNAME = 'Haus' and subcat.SUBCATEGNAME = 'Garten'
and t1.STATUS <> 'V'
AND TRANSDATE >= '2018/01/01'
AND TRANSDATE <= '2020/12/31'
group by year, month
order by year asc, month asc;
Renato Forum Administrator
Post Reply