After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 538800 - Balance Sheet: Gives wrong results
Balance Sheet: Gives wrong results
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.2.x
Other All
: Normal normal
: ---
Assigned To: Charles Day
Andreas Köhler
Depends on:
Blocks: backport
 
 
Reported: 2008-06-17 16:51 UTC by Paul Schwartz
Modified: 2018-06-29 22:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample data file that demonstrates the problem (4.05 KB, application/gnucash data)
2008-06-18 17:04 UTC, Paul Schwartz
Details

Description Paul Schwartz 2008-06-17 16:51:22 UTC
Please describe the problem:
When there is a return of capital to a stock account [no shares are traded, but money has been returned that reduces the cost basis of the stock], the balance sheet increases the value of the asset instead of decreasing it. Naturally, Assets, Liabilities, and Equity no longer balance.

Steps to reproduce:
1. Create a new sample file from the Wizard, putting a starting balance of $10000 in the Checking Account
2. Create a Stock placeholder and a stock account under it XYZ Corp
3. Debit Checking Acct $100, credit XYZ acct $100 [0 shares]
4. Run Balance Sheet for the appropriate period


Actual results:
Checking Acct assets 8090
XYZ Corp assets 2110
Unrealized Gains added to Equity for 200

Expected results:
Checking Acct assets 8090
XYZ Corp assets 1910
No Unrealized Gains 

Does this happen every time?
Yes

Other information:
I think similar errors are made when the # of shares change, but this is the simplest way to see the problem in the Balance Sheet
Comment 1 Paul Schwartz 2008-06-18 17:04:45 UTC
Created attachment 112995 [details]
Sample data file that demonstrates the problem

Sample data file to demo the bug.
Comment 2 Paul Schwartz 2008-06-25 19:47:02 UTC
I recently upgraded to 2.2.4 in Ubuntu 8.04. The behavior of the Balance Sheet report is the same.
Comment 3 Charles Day 2008-07-01 18:39:31 UTC
The effect that you are seeing is due to the price source of the report. Instead of asking GnuCash to figure out a price by the "average price" method, you would need to put the current price of $1.91 in the price editor. Then run the balance sheet with the commodity price source set to "nearest in time".

In order to do what you really are asking for here, I think that a new pricing option of "basis" would need to be implemented. Then you wouldn't need to use the price editor. This feature requested has been documented in bug 521403.

By the way, the average price is being determined by examining the two exchanges that have been recorded:
1000 @ 2.01 = 2010
0    @    0 = 100
avg price = (2010 + 100) / (1000 + 0) = 2.11
Comment 4 Paul Schwartz 2008-07-03 21:05:51 UTC
Your interpretation of my example is incorrect. The 100 is a return of capital and should be used with a minus (-) sign in the calculation. If the calculation were done correctly then the result would probably be OK and the bug would go away.

Is there a way to get the formula fixed?
Comment 5 Charles Day 2008-07-03 22:30:23 UTC
I understand your example, and I agree with you that the weighted average price formula is wrong and should be fixed. Is this all you are asking for?

I just want to make clear that this fix would still not be the same as reporting your basis. If you held the same stock in two accounts, the stock in both accounts would be revalued using the same price. The weighted average price is computed once, across all accounts, rather than per account. So neither account would be valued at its basis, except by coincidence.
Comment 6 Paul Schwartz 2008-07-03 23:48:19 UTC
I am interested in maintaining contact to the basis, but I can get around the problem you raise by making phony symbols for the same stock in different accounts. I don't use price updates anyway.

So I think fixing the formula will fix many of the problems I have with the 
Balance Sheet.

Thanks.
Comment 7 Charles Day 2008-07-08 00:21:13 UTC
A have added a new "Average Cost" price source using the formula we talked about.

Committed as r17266. Requesting backport for 2.2.
Comment 8 Andreas Köhler 2008-07-08 19:13:54 UTC
Backported by cstim in r17266 for GnuCash 2.2.6.
Thanks a lot!
Comment 9 Andreas Köhler 2008-07-08 19:24:21 UTC
I mean r17283, of course :-)
Comment 10 John Ralls 2018-06-29 22:05:34 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=538800. Please update any external references or bookmarks.