Related postings not limited to date range when using effective dates?

29 views
Skip to first unread message

IanTwenty

unread,
Feb 26, 2025, 7:59:36 AMFeb 26
to Ledger
Say I want to spread out my prize money so I don't spend it all at once:

2025/01/01 * PRIZE MONEY
    Assets:Winnings                          £ 20.17  ;  [=2025/01/01]
    Income:Prizes                           £ -20.17  ;  [=2025/01/01]
    Assets:Winnings                          £ 20.17  ;  [=2025/02/01]
    Income:Prizes                           £ -20.17  ;  [=2025/02/01]
    Assets:Winnings                          £ 20.17  ;  [=2025/03/01]
    Income:Prizes                           £ -20.17  ;  [=2025/03/01]
    Assets:Winnings                          £ 20.17  ;  [=2025/04/01]
    Income:Prizes                           £ -20.17  ;  [=2025/04/01]
    Assets:Winnings                          £ 20.16  ;  [=2025/05/01]
    Income:Prizes                           £ -20.16  ;  [=2025/05/01]
    Assets:Winnings                          £ 20.16  ;  [=2025/06/01]
    Income:Prizes                           £ -20.16  ;  [=2025/06/01]


Now I want to see where all my prize money went in January using --related:

ledger bal -f ledger.ldg Income:Prizes --begin "2025/01/01" --end "2025/02/01" --effective --related
            £ 121.00  Assets:Winnings
           £ -100.83  Income:Prizes
--------------------
             £ 20.17


Why am I picking up future related postings? I would have expected to just see:

            £ 20.17  Assets:Winnings

? Thanks

John Wiegley

unread,
Feb 27, 2025, 6:11:03 PMFeb 27
to IanTwenty, Ledger
>>>>> "I" == IanTwenty <ian....@gmail.com> writes:

I> Now I want to see where all my prize money went in January using --related:

I> ledger bal -f ledger.ldg Income:Prizes --begin "2025/01/01" --end
I> "2025/02/01" --effective --related             £ 121.00  Assets:Winnings  
I>          £ -100.83  Income:Prizes --------------------              £ 20.17

I> Why am I picking up future related postings?

It’s because your limit found postings in a given transaction, and --related
returns all the other postings in that transaction. It doesn’t apply the limit
a second time against that set.

Perhaps there is room here for a new option to specify whether limits should
also be considered in the function ‘related_posts::flush’ in the C++ code.

John

IanTwenty

unread,
Mar 4, 2025, 8:33:10 AMMar 4
to Ledger
Thanks, that makes sense.
Reply all
Reply to author
Forward
0 new messages