Filtering income statement by income type

9 views
Skip to first unread message

Joel

unread,
Nov 21, 2022, 8:48:42 PM (13 days ago) Nov 21
to hledger
Greetings, I am a long-time occasional user of hledger and looking to use income statement more. I am using hledger 1.27.1, mac-x86_64.

My typical salary posting involves 3 aspects that I track:
1. Monetary income
2. Superannuation (pension fund)
3. Annual leave balance

A MWE is shown below:
D $1,000,000.00
commodity $1,000.00

P 2022/11/18 units $2.00
P 2022/11/18 hours $50.00

2022/11/18 * Salary
        assets:checking                              $1,000
        assets:superannuation                           100 units @@ $200
        assets:leave                                     10 hours
        income:salary


I would like to be able to look at income statements relating only to cash ($, not units or hours). I have not yet found a way to satisfactorily do this.

I would like to run something like hledger is -f ./test.ledger cur:\\$, however the result is the following:
Income Statement 2022-11-18

               || 2022-11-18
===============++============
 Revenues      ||
---------------++------------
 income:salary ||  $1,200.00
---------------++------------
               ||  $1,200.00
===============++============
 Expenses      ||
---------------++------------
---------------++------------
               ||
===============++============
 Net:          ||  $1,200.00


By running this command I am trying to see the $1,000.00 line only however I cannot find a way to filter this for income statements. It seems that by writing the current value of a 'unit' in the superannuation line, hledger views the superannuation payment primarily as cash, and not in its chief unit of account.

Additionally, I cannot negate the logic usefully with hledger is -f ./test.ledger not:cur:\\$
Income Statement 2022-11-18

          || 2022-11-18
==========++============
 Revenues ||
----------++------------
----------++------------
          ||
==========++============
 Expenses ||
----------++------------
----------++------------
          ||
==========++============
 Net:     ||


This outcome didn't make much sense based on other outputs.

Ideally I would like to filter specifically the assets:superannuation and assets:leave components so that other income ancillary in other commodities will be captured in the report; filtering out 'units' and 'hours' would work for this purpose. However if I have to do something to specify only "$" as the unit, this would be a workable solution too.

Is there any way to achieve this with hledger?

Many thanks,

Joel

Simon Michael

unread,
Nov 21, 2022, 11:10:29 PM (13 days ago) Nov 21
to hledger
I am trying to see the $1,000.00 line only

Hi, I think hledger is the entry differently from what you expected, check it with print -x:

2022-11-18 * Salary
    assets:checking                  $1,000.00
    assets:superannuation    100 units @@ $200
    assets:leave                      10 hours
    income:salary                   $-1,200.00
    income:salary                    -10 hours

Maybe try writing all amounts explicitly to make things clearer ?

Simon Michael

unread,
Nov 21, 2022, 11:16:13 PM (13 days ago) Nov 21
to hledger
I might be still confused, but maybe this entry would be better:

2022/11/18 * Salary
    assets:checking                               $1,000
    assets:superannuation                        100 units
    assets:leave                                  10 hours
    income:salary

$ hledger print -x
2022-11-18 * Salary
    assets:checking             $1,000.00
    assets:superannuation       100 units
    assets:leave                 10 hours
    income:salary              $-1,000.00
    income:salary               -10 hours
    income:salary              -100 units

$ hledger is  cur:\\$
Income Statement 2022-11-18

               || 2022-11-18 
===============++============
 Revenues      ||            
---------------++------------
 income:salary ||  $1,000.00 
---------------++------------
               ||  $1,000.00 
===============++============
 Expenses      ||            
---------------++------------
---------------++------------
               ||            
===============++============
 Net:          ||  $1,000.00 

Reply all
Reply to author
Forward
0 new messages