Forecasting beginning in the future

142 views
Skip to first unread message

Phil Gee

unread,
Dec 12, 2015, 4:58:30 PM12/12/15
to Ledger
Hi, due to losing a job and moving back into my hometown I would like to use the forecast tool to estimate how long my savings last. I set up the following: 

~ Monthly until 2016/12/01
        Assets:Checking  €1460.00
Income


~ Monthly from 2016/01/01
        Expenses:Miete:new  €472.00
Expenses:1u1  €50.00
        Expenses:Papa  €100.00
        Expenses:Fahrkosten  €120.00
        Expenses:Stadtwerke  €60.00
        Expenses:Lebensmittel  €500.00
Expenses:Lovefilm  €2.00
Expenses:Kleidung  €100.00
Expenses:Gesundheit  €50.00
        Assets:Checking

~ Monthly from 2016/01/01
    Expenses:Bank  €2.00
    Assets:Checking

~ Monthly until 2016/05/01
     Expenses:KFW  €120
     Assets:Checking

~ Monthly until 2016/03/01
    Expenses:Miete:old  €593.00
    Assets:Checking

~ Monthly from 2016/04/01 until 2016/12/01
    Expenses:KFW  €300.00
    Assets:Checking

~ every 3 months from 2016/01/01
    Expenses:TVFee  €54.00
    Assets:Checking


2016/01/01 * Opening balances for January 2015
Assets:Checking  €9170.00
Equity

2016/01/01 * Umzug
     Expenses:Umzug  €1600
     Assets:Checking


As far as I understand --forecast, I should see the expected development of my checkings account when I send the command ledger -f Budget2016_ledger.txt --forecast "d<[2017]" reg assets:checking. However, if I do that, I only get

16-Jan-01 Opening balances fo.. Assets:Checking            €9170.00     €9170.00

16-Jan-01 Umzug                 Assets:Checking           €-1600.00     €7570.00

16-Jan-01 Forecast transaction  Assets:Checking            €1460.00     €9030.00

16-Jan-01 Forecast transaction  Assets:Checking            €-120.00     €8910.00

16-Jan-01 Forecast transaction  Assets:Checking            €-593.00     €8317.00

16-Feb-01 Forecast transaction  Assets:Checking            €1460.00     €9777.00

16-Feb-01 Forecast transaction  Assets:Checking            €-120.00     €9657.00

16-Feb-01 Forecast transaction  Assets:Checking            €-593.00     €9064.00

16-Mar-01 Forecast transaction  Assets:Checking            €1460.00    €10524.00

16-Mar-01 Forecast transaction  Assets:Checking            €-120.00    €10404.00

16-Mar-01 Forecast transaction  Assets:Checking            €-593.00     €9811.00

16-Apr-01 Forecast transaction  Assets:Checking            €1460.00    €11271.00

16-Apr-01 Forecast transaction  Assets:Checking            €-120.00    €11151.00

16-May-01 Forecast transaction  Assets:Checking            €1460.00    €12611.00

16-May-01 Forecast transaction  Assets:Checking            €-120.00    €12491.00

16-Jun-01 Forecast transaction  Assets:Checking            €1460.00    €13951.00

16-Jul-01 Forecast transaction  Assets:Checking            €1460.00    €15411.00

16-Aug-01 Forecast transaction  Assets:Checking            €1460.00    €16871.00

16-Sep-01 Forecast transaction  Assets:Checking            €1460.00    €18331.00

16-Oct-01 Forecast transaction  Assets:Checking            €1460.00    €19791.00

16-Nov-01 Forecast transaction  Assets:Checking            €1460.00    €21251.00

16-Dec-01 Forecast transaction  Assets:Checking            €1460.00    €22711.00



So, all the Expenses from the second, third, sixth and seventh paragraph are neglected. How can I fix this? 

Phil Gee

unread,
Dec 15, 2015, 12:37:23 AM12/15/15
to Ledger
Just FYI, I've found a workaround: I focus less on the start and more on the end of recurring transactions. With the following modification everything seems to work fine. Note the "negative Expenses" for KFW which compensate undue payments from january to march. 

~ Monthly until 2016/12/01
        Assets:Checking  €1460.00
Income

~ Monthly until 2019/01/01
        Expenses:Miete:new  €500.00
Expenses:1u1  €50.00
        Expenses:Papa  €100.00
        Expenses:Fahrkosten  €120.00
        Expenses:Stadtwerke  €60.00
        Expenses:Lebensmittel  €500.00
Expenses:Lovefilm  €2.00
Expenses:Kleidung  €100.00
Expenses:Gesundheit  €50.00
        Assets:Checking

~ Monthly until 2019/01/01
    Expenses:Bank  €2.00
    Assets:Checking

~ Monthly until 2016/05/01
     Expenses:KFW  €120
     Assets:Checking

~ Monthly until 2016/03/01
    Expenses:Miete:old  €593.00
    Assets:Checking

~Monthly until 2016/03/01
    Expenses:KFW  €-300.00
    Assets:Checking

~ Monthly until 2019/01/01
    Expenses:KFW  €300.00
    Assets:Checking

~ every 3 months until 2019/01/01
    Expenses:Zwangsgebühr  €54.00
    Assets:Checking

2016/01/01 * Opening balances for January 2015
Assets:Checking  €9170.00
Equity

2016/01/01 * Umzug
     Expenses:Umzug  €1600
     Assets:Checking

2015/01/01 * Amazon Prime
     Expenses:Sonstiges  €50.00
     Assets:Checking

John Wiegley

unread,
Dec 15, 2015, 6:50:35 PM12/15/15
to Phil Gee, Ledger
>>>>> Phil Gee <philip...@googlemail.com> writes:

> As far as I understand --forecast, I should see the expected development of
> my checkings account when I send the command ledger -f
> Budget2016_ledger.txt - -forecast "d<[2017]" reg assets:checking. However,
> if I do that, I only get

> 16-Dec-01 Forecast transaction Assets:Checking €1460.00 €22711.00

> So, all the Expenses from the second, third, sixth and seventh paragraph are
> neglected. How can I fix this?

You'll need to include expenses in the report, for them to be factored into
the forecast.

--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2

Alan

unread,
Sep 13, 2020, 6:11:01 PM9/13/20
to Ledger
Is it correct to glean from this that it doesn't work to give a "from" date in a periodic transaction? I was trying to do so, but I was not able to make it work.

John Wiegley

unread,
Sep 13, 2020, 8:53:19 PM9/13/20
to Alan, Ledger
>>>>> "A" == Alan <sf.f...@gmail.com> writes:

A> Is it correct to glean from this that it doesn't work to give a "from" date
A> in a periodic transaction? I was trying to do so, but I was not able to
A> make it work.

I would definitely expect periodic transactions to accept date ranges.

https://www.ledger-cli.org/3.0/doc/ledger3.html#Period-Expressions

John

Alan Bram

unread,
Sep 13, 2020, 10:01:12 PM9/13/20
to Alan, Ledger
Here's a demo of what I mean. Reading from "sample.dat" produces no output; compare to "another.dat." (Data files attached.)

% ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool

Copyright (c) 2003-2019, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.
% ledger -f sample.dat --forecast "d<[2022]" reg cash
% ledger -f another.dat --forecast "d<[2022]" reg cash
2020/10/01 Forecast transaction        Assets:Cash                             $-500.00         $-500.00
2020/11/01 Forecast transaction        Assets:Cash                             $-500.00        $-1000.00
2020/12/01 Forecast transaction        Assets:Cash                             $-500.00        $-1500.00
2021/01/01 Forecast transaction        Assets:Cash                             $-500.00        $-2000.00
2021/02/01 Forecast transaction        Assets:Cash                             $-500.00        $-2500.00
2021/03/01 Forecast transaction        Assets:Cash                             $-500.00        $-3000.00
2021/04/01 Forecast transaction        Assets:Cash                             $-500.00        $-3500.00
%
sample.dat
another.dat

Bob Wilson

unread,
Mar 22, 2024, 6:29:41 PMMar 22
to Ledger

I'm having the same issue.

Example file:
~ Monthly from 2024/02/15
    Expenses:Rent      $500.00
    Assets

Command:
$ ledger -f test.dat --forecast "d<[2025]" register Expenses:Rent
24-Apr-01 Forecast transaction         Expenses:Rent                             $500.00          $500.00
24-May-01 Forecast transaction         Expenses:Rent                             $500.00         $1000.00
24-Jun-01 Forecast transaction         Expenses:Rent                             $500.00         $1500.00
24-Jul-01 Forecast transaction         Expenses:Rent                             $500.00         $2000.00
24-Aug-01 Forecast transaction         Expenses:Rent                             $500.00         $2500.00
24-Sep-01 Forecast transaction         Expenses:Rent                             $500.00         $3000.00
24-Oct-01 Forecast transaction         Expenses:Rent                             $500.00         $3500.00
24-Nov-01 Forecast transaction         Expenses:Rent                             $500.00         $4000.00
24-Dec-01 Forecast transaction         Expenses:Rent                             $500.00         $4500.00

Update example file:
~ Monthly from 2024/04/15
    Expenses:Rent      $500.00
    Assets

Same command gives empty output.

The other thing I'm noticing is the periodic expressions don't respect exact dates. If my rent is due on the 15th, and my period expression denotes that, I'd expect the forecasted transactions to be on the 15th.

ledger --version:
Ledger 3.3.2-20230330, the command-line accounting tool
without support for gpg encrypted journals and without Python support

Copyright (c) 2003-2023, John Wiegley.  All rights reserved.


This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.

Bob Wilson

unread,
Mar 22, 2024, 6:46:46 PMMar 22
to ledge...@googlegroups.com
Also, "balance" gives a different answer than "register" in that example.


On Mar 22, 2024, at 3:29 PM, Bob Wilson <mills...@gmail.com> wrote:


--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/28cce2ba-9e3d-48ae-9096-8c8e6e6f67e2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages