hledger icon indicating copy to clipboard operation
hledger copied to clipboard

Incorrect historical balance when no transaction in report period

Open psamim opened this issue 5 months ago • 1 comments

Hi,

I have below ledger test.ledger file:

2024-01-01 * Opening Balance
    Assets:Cash                1000.00 USD
    Equity:Opening-Balance    -1000.00 USD

When I ask for yearly historical balance I get:

> hledger bal ^assets -f test.ledger -b 2025 --historical  --yearly
Ending balances (historical) in ..:


==++==
--++--
  ||

My expectation is to see the 1000 USD since the documentation mentions it "includes postings before report start date".

If I change the ledger file to:

2024-01-01 * Opening Balance
    Assets:Cash              1000.00 USD
    Equity:Opening-Balance  -1000.00 USD

2025-01-01 * Yearly Adjustment
    Assets:Cash               0 USD
    Equity:Yearly-Adjustment  0 USD

Now the yearly historical balance is correctly reported:

Ending balances (historical) in 2025:

             ||  2025-12-31
=============++=============
 Assets:Cash || 1000.00 USD
-------------++-------------
             || 1000.00 USD

Good to mention;

> hledger --version
hledger 1.43.1, linux-x86_64

psamim avatar Jun 09 '25 13:06 psamim

Thanks for the report. I agree that is a little odd. It's not a new behaviour.

simonmichael avatar Jun 09 '25 17:06 simonmichael

Fixed in master.

simonmichael avatar Jun 16 '25 08:06 simonmichael