Monthly category report with selectable categories and time range?

Build and share your cool customized reports built w/ one sql, Chart.js and Lua (https://github.com/moneymanagerex/general-reports)

Moderator: Renato

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 »

those lines give me:
SQL logic error[1]: no such column: t1.STATUS
User avatar
Renato
MVP MMEX User
Posts: 399
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 »

.
this is my SQL Code:

Code: Select all

-- TODO: Update category and subcategory name in line 19. 
select strftime('%Y', t1.TRANSDATE) as YEAR
    , strftime('%m', t1.TRANSDATE) as MONTH
    , total(t1.TRANSAMOUNT * c1.BASECONVRATE) 
    + (select total(split.SPLITTRANSAMOUNT * c2.BASECONVRATE) from CHECKINGACCOUNT_V1 as t2
       inner join ACCOUNTLIST_V1 as a2 on a2.ACCOUNTID = t1.ACCOUNTID
       inner join CURRENCYFORMATS_V1 as c2 on c2.CURRENCYID = a2.CURRENCYID
       inner join SPLITTRANSACTIONS_V1 as split on t2.TRANSID = split.TRANSID
       where strftime('%Y', t2.TRANSDATE) = strftime('%Y', t1.TRANSDATE)
       and strftime('%m', t2.TRANSDATE) = strftime('%m', t1.TRANSDATE)
       and split.CATEGID = cat.CATEGID
       and split.SUBCATEGID = subcat.SUBCATEGID
       and t2.STATUS <> 'V') as AMOUNT
from CHECKINGACCOUNT_V1 as t1
inner join ACCOUNTLIST_V1 as a1 on a1.ACCOUNTID = t1.ACCOUNTID
inner join CURRENCYFORMATS_V1 as c1 on c1.CURRENCYID = a1.CURRENCYID
inner join CATEGORY_V1 as cat on t1.CATEGID = cat.CATEGID
inner join SUBCATEGORY_V1 as subcat on t1.SUBCATEGID = subcat.SUBCATEGID
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;
regards Renato use MMEX since 2009, now with Windows 11
dbolton
MVP MMEX User
Posts: 96
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 »

I created a new report that lets you select the period and category.

Instructions
  1. Download the attachment below (Category amounts over time.grm)
  2. Open Money Manager Ex
  3. From the main menu, choose Tools > General Report Manager
  4. Choose Import and select the download file (Category amounts over time.grm )
  5. Choose Close
  6. In the left pane choose Reports > Category amounts over time
Attachments
Category amounts over time.grm
(2.68 KiB) Downloaded 30 times
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 dbolton!

Please is there a way to make the following improvements?:
  • ability to select by sub category as well
  • remember Category/sub-category selection when date Period changes (currently reverts to 1st category!)
  • report the average value over the selected period
  • tabulate data under the chart
D Green
dbolton
MVP MMEX User
Posts: 96
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 »

I understand the want for subcategories. I want it myself, but omitted it to begin with (to simplify making the report).

I don't know a way to remember the category selection using the built-in date selection (It reloads the whole page from scratch using new data each time you select a period). Out of curiosity, what do you use the period selection for? I tend to pick "Over Time" and not change it after that.

Also it would be helpful to understand how you would use the data table. The chart does show the exact numbers if you hover. Are you looking for a table that matches the category you select and shows the same data as the chart (plus maybe the averages)?
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: Fri Apr 29, 2022 1:56 am Out of curiosity, what do you use the period selection for? I tend to pick "Over Time" and not change it after that.
At the end of each month I want to see what our spending has been in category 'Food' subcat 'Grocery shopping' over 'Last 90 days' say, so that I can see how we've done against previous months.
dbolton wrote: Fri Apr 29, 2022 1:56 amAlso it would be helpful to understand how you would use the data table. The chart does show the exact numbers if you hover. Are you looking for a table that matches the category you select and shows the same data as the chart (plus maybe the averages)?
I'm trying to easily read each month's values. A table showing each month's value would help, or annotation on the chart itself. Yes - I'd expect data only for the cat/sub-cat I've selected. The average value (plus a line on the graph!) would be helpful.

For inspiration, the Homebank application handles this reporting pretty neatly, although average only shown with cumulative data:
1.png
1.png (48.12 KiB) Viewed 530 times
2.png
2.png (52.79 KiB) Viewed 530 times
3.png
3.png (54.98 KiB) Viewed 530 times
Nikolay
MMEX Developer
Posts: 1524
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 »

Have you already looked at the budget reports?
Post Reply