Two questions about budgeting

2023-01-23 Thread Marcin Borkowski
Hi all,

as I mentioned previously, I finally decided to finish my booklet about
Ledger, and I really want to show how to do budgeting with it.

However, I myself cannit grok it.  Please help.

Here is my example file (totally fake).

--8<---cut here---start->8---
~ Daily
Expenses:Food  30.00 PLN
Assets

~ Monthly
Expenses:Books200.00 PLN
Assets

2022-01-02 Groceries
Expenses:Food  20.00 PLN
Assets:Cash

2022-01-03 C.S.Lewis "That hideous strength"
Expenses:Books 45.00 PLN
Assets:Cash

2022-01-03 Groceries
Expenses:Food  100.00 PLN
Assets:Cash
--8<---cut here---end--->8---

I ran a budgeting command against this file, and I don't know how to
interpret its output.

--8<---cut here---start->8---
$ ledger reg -f budget-example.ledger ^expenses -b 2022-01-01 -e 2022-01-04 -y 
%Y-%m-%d --invert --budget
2022-01-02 Budget transaction  Expenses:Food30.00 PLN   30.00 PLN
2022-01-01 Budget transaction  Expenses:Books  200.00 PLN  230.00 PLN
2022-01-02 Groceries   Expenses:Food   -20.00 PLN  210.00 PLN
2022-01-03 Budget transaction  Expenses:Food30.00 PLN  240.00 PLN
2022-01-03 C.S.Lewis "..." Expenses:Books  -45.00 PLN  195.00 PLN
2022-01-03 Groceries   Expenses:Food  -100.00 PLN   95.00 PLN
--8<---cut here---end--->8---

1. Why is there no "budget transaction" for groceries for 2022-01-01?
2. I would assume that after these three days my "books" budget should
   allow me to spend 155 PLN more on books and my "food" budget would
   be short of 30 PLN.  Yet I can see neither of these amounts in the
   report.  How to make Ledger compute them?

TIA,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87mt68nzd8.fsf%40mbork.pl.


Re: How to compute average monthly expenses?

2023-01-23 Thread Marcin Borkowski


On 2023-01-24, at 01:06, John Wiegley  wrote:

>> o1bigtenor   writes:
>
>> That - sir - - - -begs the question - - - what is 'average' supposed to do?
>
> Average just takes the number of entries in a group, and divides the total by
> the count. Here's the implementation:
>
>   OPTION_(report_t, average, DO() { // -A
>   OTHER(empty).on(whence);
>   OTHER(display_total_)
> .on(whence, "count>0?(display_total/count):0");
> });
>
> Which means that `--average` is just a short-hand for:
>
>   --empty --display-total "count>0?(display_total/count):0"

Thanks for the answer, but that still does not explain the "450" figure
for me.  Of course, the total is 2700, so I assume Ledger divided it by
6 -- but why 6?

(Also, since I've decided to finally finish my booklet on accounting
with Ledger, expect more questions soon;-) -- hope that's ok with
you...)

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87o7qonzwq.fsf%40mbork.pl.


Re: How to compute average monthly expenses?

2023-01-23 Thread John Wiegley
> o1bigtenor   writes:

> That - sir - - - -begs the question - - - what is 'average' supposed to do?

Average just takes the number of entries in a group, and divides the total by
the count. Here's the implementation:

  OPTION_(report_t, average, DO() { // -A
  OTHER(empty).on(whence);
  OTHER(display_total_)
.on(whence, "count>0?(display_total/count):0");
});

Which means that `--average` is just a short-hand for:

  --empty --display-total "count>0?(display_total/count):0"

John

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m235806bjk.fsf%40newartisans.com.


Re: How to compute average monthly expenses?

2023-01-23 Thread o1bigtenor
On Mon, Jan 23, 2023 at 4:58 PM John Wiegley  wrote:
>
> > "MB" == Marcin Borkowski  writes:
>
> MB> What is going on here? (Obviously, I expected 900 PLN monthly average.)
> MB> Even more unexpectedly, when I use -p "last year", the result is exactly
> MB> the same (and I would expect 300 PLN then).
>
> I'm not sure that "--average" has ever done what everyone expects in the
> balance report.
>

That - sir - - - -begs the question - - - what is 'average' supposed to do?

TIA

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPpdf588ERiH6AyDZhzWZDqX%2BpkME3B8yuZ025Zfqadzq4OPjw%40mail.gmail.com.


Re: How to compute average monthly expenses?

2023-01-23 Thread John Wiegley
> "MB" == Marcin Borkowski  writes:

MB> What is going on here? (Obviously, I expected 900 PLN monthly average.)
MB> Even more unexpectedly, when I use -p "last year", the result is exactly
MB> the same (and I would expect 300 PLN then).

I'm not sure that "--average" has ever done what everyone expects in the
balance report.

John

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m2a628c0yw.fsf%40newartisans.com.


Re: How to compute average monthly expenses?

2023-01-23 Thread Marcin Borkowski


On 2023-01-23, at 21:12, Stanko Trček  wrote:

> How about this ?
>
> ledger -f data.txt --monthly --average  register Expenses

Ah, I think this works.  I'll perform a few more experiments.  Thanks!

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87r0vlnfdy.fsf%40mbork.pl.


Re: How to compute average monthly expenses?

2023-01-23 Thread Stanko Trček
How about this ?

ledger -f data.txt --monthly --average  register Expenses

ponedeljek, 23. januar 2023 ob 06:04:08 UTC+1 je oseba Marcin Borkowski 
napisala:

> Hi all,
>
> I try to follow the example from the manual and compute average monthly
> expenses. Here is my example journal file:
>
> --8<---cut here---start->8---
> 2022-01-01 Food
> Expenses:Food 930.00 PLN
> Assets:Cash
>
> 2022-02-01 Food
> Expenses:Food 800.00 PLN
> Assets:Cash
>
> 2022-03-01 Food
> Expenses:Food 970.00 PLN
> Assets:Cash
> --8<---cut here---end--->8---
>
> and here is what I do in command line:
>
> --8<---cut here---start->8---
> ledger -b 2022-01-01 -e 2022-04-01 --monthly --average balance -f myfile
>
> -450.00 PLN Assets:Cash
> 450.00 PLN Expenses:Food
> 
> 0
> --8<---cut here---end--->8---
>
> What is going on here? (Obviously, I expected 900 PLN monthly average.)
> Even more unexpectedly, when I use -p "last year", the result is exactly
> the same (and I would expect 300 PLN then).
>
> I use Ledger 3.2.1-20200518.
>
> TIA,
>
> -- 
> Marcin Borkowski
> http://mbork.pl
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/836053c1-c5a0-4222-95bb-60a3a7db9084n%40googlegroups.com.