GNOME Bugzilla – Bug 347274
to track the difference between budgeted and actual amounts in the budget report
Last modified: 2018-06-29 21:09:24 UTC
It would be useful (in my case necessary) to be able to track both the period-by-period difference and the cumulative difference between the (total) budgeted amount and the (total) actual amount. For example, a budget report could display (1) the difference between the two amounts for the week, month, etc., that is the budget's time-increment; and (2) the cumulative difference between the totals of the two amounts for the entire period budgeted to date.
I'll vote for this bug. The budgeting functionality is helpful, but the changes suggested above would make it really functional. In the same vein, I suggest calculating the sum of all budge items for a period, so users can see if the budget exceeds actual income.
I'll second that vote. I continue to be required to have a spreadsheet open to handle my budget to actual cash flows. I have been using gnucash for several years and was excited that a budgeting feature was added (thanks Chris!). But doing the math on the budget vs. actual and having the difference summed for that period would allow for the "in period" financial decisions to be informed. Here's what I am currently doing in a spreadsheet. Its kind of a combo budget/cash flow. If I am crazy for seeing it this way, let me know. For each period (excuse the formatting): Income: Expected , Actual - $Checking Account Actual *Expenses: Budgeted - Actual = *Remaining Expenses* ------------------------------------------ sum sum SUM * Categorized list I have tried doing this using a AR / AP method, but that was overkill and not really correct accounting (because its only budgeted). In any case, being able to point the "Checking Account Actual" at the appropriate gnucash account, would greatly inform the budget report if sums were included.
I also vote for this bug. This functionality would be very useful for me, and would help me wean my comrades off of MS Money.
If I am understanding this right, I am very in need of this functionality as well. The way I'm thinking of it is, suppose I setup a budget with all the income and expenses I expect; lets say this is setup to display in bi-weekly periods (i.e. per paycheck). I'd like the budget screen to calculate sums per budget period based on my current balance in my actual accounts. for example the first 2 weeks would use this: (current actual balance of bank accounts & cash) + bi-weekly budget assets - bi-weekly budget expenses the result of that could be displayed at the bottom of the bi-weekly budget column. For the next period you would do the same thing except use the result of the first period as the (current actual balance of bank accounts & cash) for the second period. Then if things start going negative, I know that my budget is not realistic in terms of how much I currently have, how much I think I'm going to make and how much I'm planning on spending.
As a quick fix, can we have just a summaries for each category in budget? There is a HUGE need for that!!! Thanks!
Created attachment 100668 [details] [review] implements new column difference=(budget-actual) I have not yet discovered why budget and actual are not in the same scale, so I just divide actual by 100 to compensate. It seems to work fine. Sticking to the title of this bug, I suggest closing this bug with this patch. Then, use bug 500696 for a separate request for adding summaries.
Created attachment 100669 [details] new budget.scm For those wanting this enhancement without going through the patching process, simply replace your existing budget.scm with this attachment.
It turns out this patch is not ready or there is a problem somewhere else. On Windows both budget and actual are sometimes (but not always) inflated by 100, but on Linux only actual is. Both are Gnucash 2.2.1. Hmm.
Created attachment 100912 [details] [review] better patch This patch is more robust: it handles GC's numeric data types.
Created attachment 100913 [details] [review] new budget.scm complete budget.scm drop-in replacement for easy use
Created attachment 100917 [details] [review] nice cosmetic change from andrewsw
Created attachment 100975 [details] [review] Change reverse patch to forward patch. Mea culpa. Spotted by Derek.
Thanks for giving this a go Andrew. I tried the patch on Gnucash 2.2.1 (gentoo-linux x86_64; gnome 2.20) When running the report for the first time, I received the following in the new report tab: Report error An error occurred while running the report. And the following on the console: 109: 38 (let* ((num-periods #) (period 0)) (letrec (# #) (catch # # #))) In unknown file: ... ?: 39 [catch break #<procedure #f ()> #<procedure #f v>] ?: 40* [#<procedure #f ()>] ?: 41* [continue] ?: 42 (or (not (< period num-periods)) (begin (begin (let* # # ...)) (continue))) ?: 43 (begin (begin (let* (# # # ...) (cond #) ...)) (continue)) ?: 44* (begin (let* (# # # ...) (cond #) ...)) In /usr/share/gnucash/guile-modules/gnucash/report/budget.scm: 113: 45 (let* (# # # ...) (cond #) ...) 134: 46* [gnc-numeric-sub # # 0 ... 136: 47* (bitwise-ior 48 8) /usr/share/gnucash/guile-modules/gnucash/report/budget.scm:136:33: In expression (bitwise-ior 48 8): /usr/share/gnucash/guile-modules/gnucash/report/budget.scm:136:33: Unbound variable: bitwise-ior
Perhaps use + instead of bitwise-ior? Does that fix it for you?
I can only test Fedora 7 (32-bit) and Windows XP. Both seem fine with + or bitwise-ior.
bitwise-ior appears to be in slib, but "+" should work too (in THIS particular case). If the + works for you then we can try using that.
Changing bitwise-ior to + solved the problem for me. The budget report displays correctly on gnucash 2.2.2 x86_64. Thank you. On a side note, I did retry the bitwise-ior because upgrading to gnucash 2.2.2 on gentoo pulled in slib as a dependency for the first time. But even when I confirmed slib was in place only + worked. I think it was an error that they didn't have it listed as a dependency previously, note the Changelog for the ebuild: *gnucash-2.2.2 (18 Dec 2007) 18 Dec 2007; Torsten Veller <toveATgentoo.org> +files/gnucash-2.2.2-icons.patch, +gnucash-2.2.2.ebuild: Version bump. Thanks to Alex Rostovtsev for the icons patch (#199730). Change goffice dependency because gnucash works with >=goffice-0.5.1 (#191555). 25 Oct 2007; Torsten Veller <toveATgentoo.org> gnucash-2.2.1-r1.ebuild: Change slib dependency
James, can you paste an update to the patch in attachment 100975 [details] [review] ?
Created attachment 114379 [details] [review] patch against trunk (In reply to comment #10) > Created an attachment (id=100913) [edit] > new budget.scm > > complete budget.scm drop-in replacement for easy use I reworked attachment 100913 [details] [review] as a patch against current trunk (but dropped the line which would have deleted the report-guid entry)
(In reply to comment #19) > I reworked attachment 100913 [details] [review] [edit] as a patch against current trunk (but dropped the > line which would have deleted the report-guid entry) The patch looks fine in principle; however, this adds another column unconditionally i.e. for everyone. This is probably not so desirable, because if there are many periods in the report, there are already a large number of columns with numbers. The patch would be perfect if you could make this new column a user option, i.e. it would be be possible to retain the current display. I'd commit it immediately if the new column is activated through a user option. Thanks!
BTW this looks very similar to bug#532060. Could the patch there please be merged with this one? Thanks.
Created attachment 121483 [details] [review] Combined patch for bug#532060 and bug#347274 I merged the difference column of bug#347274 into the structure of bug#532060.
Could you please check again line 162? (dif-numeric-val (gnc-numeric-sub bgt-numeric-val act-numeric-val GNC-DENOM-AUTO (bitwise-ior GNC-DENOM-LCD GNC-RND-NEVER))) For income and liability accounts it seems to yield the sum of budget and actual values.
*** Bug 555171 has been marked as a duplicate of this bug. ***
*** Bug 532060 has been marked as a duplicate of this bug. ***
Committed as r17675, awaiting audit and back-port. Thanks a lot!
Created attachment 121777 [details] [review] Fixes previous patch to calculate correct differences The patch as committed in r17675 should not be backported, because the proposed calculation of differences was wrong for income and liabilities(see comment #23). The attached patch should fix this issue. Please make sure to apply this one too.
Committed as r17678, so that both 17675 and 17678 should be back-ported. Thanks a lot!
On my opensuse system the report crashed because of bitwise-ior not available. I changed this into + according to comment 16; committed as r17684 which would need to be back-ported as well.
*** Bug 500696 has been marked as a duplicate of this bug. ***
Hm... after seeing the outcome of this patch "in real life", it occurred to me that it's not longer possible to see only the "Budget" and "Actual" columns. Instead, one has the choice to see either all three columns or one single column. I would like to continue to use the report in the form that it was, i.e. with the budget and actual column alone. This would be achieved by changing the option from one single multichoice (combo box) option into several boolean options. Those should go into a new, separate "View" tab in the whole dialog, similar to the "transaction" report and most of the others as well. @C.Ernst: Do you think you could provide yet another patch that changes these options? That would be great!
I've just patched budget.scm with the two patches below - very nice. Thanks for this! Two wishes: 1) For Income and Expenses, if the Diff column is negative, can it change colour (red?)? I could be asking a bit much - reverse balanced accounts might have to be considered too (i.e. whether a negative diff is a "red" number or "black" for, say, Liabilities). 2) Account totals, much like the Account Summary report - total expenses, total assets, etc, per budget period. If I read correctly, something like this was suggested earlier in the thread (Don at 4). To my untrained eyes, this looks like a big ask, so thanks in advance to anyone who considers it. It would be a tremendous benefit. Thanks again for all this. It's a wonderful piece of software.
Created attachment 123632 [details] [review] Select individual columns to be displayed in the budget report This patch introduces a new option tab "Display" with boolean options for each column, as proposed in comment 31. The default behaviour was (and is now again) to display only Budget and Actual. There still seem to be lots of improvements possible to the budget report. However, I'd vote for opening new issues and closing this one, after the patch has been applied. - After all, I just wanted to be able to export the single columns Actual to excel ;-)
Committed to trunk, r17743. Thanks a lot! This bug will be closed as soon as the set of patches is back-ported to the 2.2 branch. Indeed, all new feature requests should be filed as new bugzilla items. Thanks again!
Committed to 2.2 branch, r17752. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=347274. Please update any external references or bookmarks.