Don't skip empty months in register output

26 views
Skip to first unread message

Kuba Orlik

unread,
Jan 9, 2016, 2:37:52 AM1/9/16
to Ledger
I'd like to calculate the monthly average for an account. For some months there are no transactions for that account, so they're skipped in the report:

```
15-Feb-01 - 15-Feb-28                                             614f8029:b0ed38f7:63c4a2cd                                                                    A10                               A10
15-Mar-01 - 15-Mar-31                                             acf0c194:252ea46f:e0ca2397                                                                    A15                               A13
15-Jun-01 - 15-Jun-30                                             36627610:4084f57e:aff94c59                                                                    A90                               A38
15-Sep-01 - 15-Sep-30                                             bcb7993f:beb4d8a2:548317c3                                                                   A182                               A74
15-Nov-01 - 15-Nov-30                                             b86199e2:36cdc1c1:7db71874                                                                   A179                               A95
                                                                  c48a28fc:f97930c4:41dbfd1e                                                                   A130                              A101
```

The problem is that the total is divided by a smaller number than it should be (in the above example it should be `10`, but is `5`). How do I make ledger consider the empty months as well?

Simon Michael

unread,
Jan 9, 2016, 11:37:53 AM1/9/16
to ledge...@googlegroups.com
On 1/8/16 11:37 PM, Kuba Orlik wrote:
> The problem is that the total is divided by a smaller number than it should
> be (in the above example it should be `10`, but is `5`). How do I make
> ledger consider the empty months as well?

Always use -E/--empty with -A, to include the zero months and get an
accurate average. In hledger, -A implies -E for this reason.


Kuba Orlik

unread,
Jan 9, 2016, 12:59:13 PM1/9/16
to Ledger
It works, thank you!! :)

-----
Kuba



--

---
You received this message because you are subscribed to a topic in the Google Groups "Ledger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ledger-cli/LA0Bwicj7WM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Wiegley

unread,
Jan 9, 2016, 3:33:40 PM1/9/16
to Simon Michael, ledge...@googlegroups.com
>>>>> Simon Michael <si...@joyful.com> writes:

> In hledger, -A implies -E for this reason.

This is a great idea; I've just pushed a commit that establishes the same
implication for C++Ledger.

--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
Reply all
Reply to author
Forward
0 new messages