This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Ledger isn't summing up numbers correctly?

Tags: None
(comma "," separated)
mikethetall
Registered Member
Posts
5
Karma
0
I'm seeing something very strange - KMyMoney isn't correctly summing up numbers in a ledger. Like not even close.

The opening balance (and first transaction in the account) should set it to +2,542.19, but at the end of that transaction KMyMoney says that the total is -5653.19.

After making a payment (account increase for this Asset) of 425.00 KMyMoney says the new balance is -8,195.38. I can't see how these are even related - if I got the sign wrong on the payment (or misunderstood what a payment does to the balance) then I should still be able to add/subtract/something 425 and 2542.19 (or -5,653.19) and get a the -8K number.

Here's a screenshot if it helps:

https://pasteboard.co/3SYwLkhzHVjQ.png

(There's more transactions that have similar problems).

I used to have everything set up ok in this account but now it looks like this.

I think that what I did to mess it up was this:
1. Get this account set up perfectly - all the transactions totaled up to what I'm seeing on my statements/in the online bank account right now.
2. Try to reconcile a different account, where some transfers into this (messed up) account originated.
3. Not realize that the transfer transactions in that other account need to be Matched & Accepted, and instead delete the 'extra' ones.
4. Finish reconciling that other account, feel good about KMyMoney, my work here, and my life in general. Pat myself on the back.
5. Examine this account, now messed up as described & pictured above, and manage to barely hold back the tears of frustration and disappointment.

If anyone has any ideas on how to fix this I would so, so appreciate hearing them!

Thank you in advance!
--Mike
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS
Everything seems to calculate nicely - just not the way you look at it causes confusion. Example (taken from the last three lines of your screenshot): -7,770.38 - 425.00 = -8,195.38 + 2,542.19 = -5,653.19. KMyMoney adds the balances from top to bottom.

Solution: reverse the sort order of your ledger so that the opening balances transaction is the very first transaction in the list. You can do that by right clicking on the header of the ledger. Make sure that date options sort in ascending manner. That should get your balances straight. For now, I don't see any other problem, which does not mean there couldn't be any, but that is for another time.

Hope that helps.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
mikethetall
Registered Member
Posts
5
Karma
0
First, thank you very, very much for your help! I appreciate your expert help and the incredible speed of your response! Thank you!

Looking at it, you're right - it's adding up the transactions from top to bottom. If I change the sort order like you said then the opening balance is at the top, and it's correct.

Can I ask why it's doing that? I assumed that KMM would add up transactions based on the chronological order in which they were posted to the account, not based on how I'm choosing to sort the transactions at this moment.

Thanks!
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS
mikethetall wrote:Can I ask why it's doing that? I assumed that KMM would add up transactions based on the chronological order in which they were posted to the account, not based on how I'm choosing to sort the transactions at this moment.

That's simple. Because we (or was it just me) decided about 15 years ago to implement it that way because there were no other requirements :D The reason was and is probably that the balance is not stored persistently but recalculated whenever the ledger is modified. The latest development version does not allow you to change the sort order so this cannot happen. At least as long as noone objects.

Hope that explains it and answers your question.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
mikethetall
Registered Member
Posts
5
Karma
0
That makes sense :)

Thank you for starting KMM 15 years ago - it's really great, and incredibly useful. Also, RIP MS Money :)

I was looking at some other views in KMM (specifically, the 'ledger' for a particular category) and noticed that the 'Balance' column is doing exactly what you said - it's summing things up, from top to bottom. It's actually pretty useful to be able to see the total for all the transactions in a particular category.

Preventing people from re-sorting the rows will prevent this issue from coming up, for sure. That's more-or-less the solution I came up with ("Gee, I guess I won't re-sort things").

I also wonder about renaming the column to be "Sum" instead of "Balance", since that's what it is. That said, I'm sure there's a lot of documentation & screenshots out there that show 'Balance' and I don't think it's a worthwhile change if it invalidates/confuses existing docs and tutorials.

But hey - these are the decisions that you get to make, so have fun with them. And based on how awesome KMM is right now I'm sure you'll do fine whatever you decide :)


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Evergrowing, Google [Bot], rblackwell