Odd (?) interaction between virtual postings and budget entries

31 views
Skip to first unread message

Adolfo Villafiorita

unread,
Feb 16, 2021, 5:06:04 PM2/16/21
to hle...@googlegroups.com
Hello -
forecast are set to zero when there are virtual postings in the same period. I am not sure it is intended or not.

To make it clearer. Suppose I have the following file:

> cat a.ledger
~ monthly
 groceries  10.00
 cash

then:

> hledger balance -Q -f a.ledger --forecast
Balance changes in 2021-01-01..2021-09-30:

           || 2021Q1  2021Q2  2021Q3
===========++========================
cash       || -10.00  -30.00  -20.00
groceries  ||  10.00   30.00   20.00
-----------++------------------------
           ||      0       0       0

which is what I expected.

However, If I add to the file the following virtual posting:

2021-03-01
     (movies)   10.00
     (credit)

then the report changes, forecasting groceries to zero in Q1 (where the virtual posting belongs). The behavior does not change even when --real is used. Notice that other periods are not affected.

hledger balance -Q -f a.ledger --forecast
Balance changes in 2021-01-01..2021-09-30:

           || 2021Q1  2021Q2  2021Q3
===========++========================
cash       ||         -30.00  -20.00
groceries  ||      0   30.00   20.00
movies     ||  10.00       0       0
-----------++------------------------
           ||              0       0


Is there a way to have virtual postings and forecast live together?

  thanks in advance!
  - adolfo

Dmitry Astapov

unread,
Feb 16, 2021, 5:38:41 PM2/16/21
to hle...@googlegroups.com
Hi!

I think this could help:

     --forecast[=PERIODEXP]              Generate periodic transactions (from
                                         periodic transaction rules). By
                                         default these begin after the latest
                                         recorded transaction
, and end 6 months
                                         from today, or at the report end date.
                                         Also, in hledger-ui, make future
                                         transactions visible.
                                         Note that = (and not a space) is
                                         required before PERIODEXP if you wish
                                         to supply it.

Given that you want your forecast transaction to "coexist" with real transactions, you probably need to supply custom period expression here

--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/CALVd%2Bxhn4V7ZEZ_1XTq7o0%3D11vy2_ADd3NHB0%3Dp0ZL_TOmS4pg%40mail.gmail.com.


--
D. Astapov

avilla...@gmail.com

unread,
Feb 16, 2021, 5:44:50 PM2/16/21
to hledger
Hi -
I was playing with different budgeting scenarios and .... I got lost in numbers!
... the default behavior does indeed make sense.

Thanks for helping out!

-a
Reply all
Reply to author
Forward
0 new messages