Skip to content

Yearly balance report is wrong #2383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PSLLSP opened this issue May 10, 2025 · 3 comments
Open

Yearly balance report is wrong #2383

PSLLSP opened this issue May 10, 2025 · 3 comments

Comments

@PSLLSP
Copy link

PSLLSP commented May 10, 2025

I am not sure if this is a bug or an expected behavior. I am not expert on double-entry accounting. I am just surprised with the report..

$ hledger --version
hledger 1.42.1, linux-x86_64

Simple balance, it is correct:

$ hledger -f demo-bug4.journal bal
                -900  assets:user
                 400  expenses
                 500  liabilities:utility
--------------------
                   0  

I do not like report for yearly balance: Isn't balance of of account liabilities:utility in 2023 still 500 ??

$ hledger -f demo-bug4.journal bal -Y
Balance changes in 2021-01-01..2023-12-31:

                     || 2021  2022  2023 
=====================++==================
 assets:user         || -700  -200     0 
 expenses            ||    0   200   200 
 liabilities:utility ||  700     0  -200 
---------------------++------------------
                     ||    0     0     0 

The report prints "Balance changes"

I would like to see something similar to balance sheet:

$ hledger -f demo-bug4.journal bs -Y
Yearly Balance Sheet 2021-12-31..2023-12-31

                     || 2021-12-31  2022-12-31  2023-12-31 
=====================++====================================
 Assets              ||                                    
---------------------++------------------------------------
 assets:user         ||       -700        -900        -900 
---------------------++------------------------------------
                     ||       -700        -900        -900 
=====================++====================================
 Liabilities         ||                                    
---------------------++------------------------------------
 liabilities:utility ||       -700        -700        -500 
---------------------++------------------------------------
                     ||       -700        -700        -500 
=====================++====================================
 Net:                ||          0        -200        -400 

For balance the report should look like this:

                     || 2021  2022  2023 
=====================++==================
 assets:user         || -700  -900  -900 
 expenses            ||    0   200   400 
 liabilities:utility ||  700   700   500 
---------------------++------------------
                     ||    0     0     0

Demo journal:

$ cat demo-bug4.journal
2021-12-10 payment
   assets:user           -700
   liabilities:utility

2022-01-11 payment for service
   liabilities:utility
   expenses              100

2022-06-12 payment for service
   liabilities:utility
   expenses              100

2022-12-13 payment
   assets:user           -200
   liabilities:utility

2023-01-14 payment for service
   liabilities:utility
   expenses              100

2023-06-15 payment for service
   liabilities:utility
   expenses              100
@PSLLSP
Copy link
Author

PSLLSP commented May 10, 2025

Update. I have found that I can get expected report with "historical" option:

$ hledger -f demo-bug4.journal bal -Y -H

Ending balances (historical) in 2021-01-01..2023-12-31:

                     || 2021-12-31  2022-12-31  2023-12-31 
=====================++====================================
 assets:user         ||       -700        -900        -900 
 expenses            ||          0         200         400 
 liabilities:utility ||        700         700         500 
---------------------++------------------------------------
                     ||          0           0           0 

It is not consistent. Balance sheet report is "historical" by default but "balance" report is "change" by default....

@simonmichael
Copy link
Owner

simonmichael commented May 10, 2025

Hi @PSLLSP. I agree it's a bit confusing.

We inherited this behaviour and naming from Ledger: the so-called balance report is really a report of balance changes. It can show end balances only if you use it in the right way (including all relevant postings). And this becomes more noticeable when you are using hledger's multi-period balance reports.

hledger tried to make this easier, by

  • adding an easy -H/--historical flag
  • adding the balancesheet report, which has -H turned on by default
  • showing a report heading which tells which mode you're in (except in a simple balance report with no report interval, for compatibility with ledger balance).

Related:

@simonmichael
Copy link
Owner

This is one reason why hledger command help and docs push balancesheet and friends as the "easy/standard reports", and demphasise balance as an "advanced report".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants