Re: How to compute average monthly expenses?

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

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

Hmmm.. good question, I wonder where that count is coming from.

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

Yes, very OK with me!

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/m2h6wbejv7.fsf%40newartisans.com.


Re: How to compute average monthly expenses?

2023-01-25 Thread Ihor Radchenko
Marcin Borkowski  writes:

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

What about the last time group where the expenses may not yet represent
the value at the end of the month?

P.S. I am wondering why I am only seeing Marcin's emails.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

-- 

--- 
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/878rhs7486.fsf%40localhost.


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.


How to compute average monthly expenses?

2023-01-22 Thread Marcin Borkowski
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/87y1pton9k.fsf%40mbork.pl.