Budget Filtering

29 views
Skip to first unread message

Igbanam Ogbuluijah

unread,
Jun 5, 2024, 2:51:47 AMJun 5
to Ledger
Hi all,

I ran into some issue using ledger to track "benefits"; the general case is "how to filter a budget balance" — p.s: if ledger is working as should, please teach me. I'm new here.

The simplest case ledger which shows this is

~ yearly
    Paid:Leave  10 day
    Unpaid:Leave  5 day
    Benefits


The balance comes up as expected


; bal --budget
; ============
              15 day  Benefits
             -10 day  Paid:Leave
              -5 day  Unpaid:Leave
--------------------
                   0


But when I "filter out" the Unpaid: benefits, I get this

; bal --budget not Unpaid:
; ========================
              15 day  Benefits
             -10 day  Paid:Leave
--------------------
               5 day


I expected to get this instead


; bal --budget not Unpaid:
; ========================
              10 day  Benefits
             -10 day  Paid:Leave
--------------------
                   0


Is this something wrong with Ledger, or is there some information you can share with me to upgrade my ledger-fu here?

Looking forward to learning!

Thanks.

- Igbanam

Igbanam Ogbuluijah

unread,
Jun 26, 2024, 6:23:40 PM (9 days ago) Jun 26
to Ledger
Hi all,

Just wanted to bump this to see if anyone had any ideas yet.

Thanks!

Tavis Ormandy

unread,
Jun 27, 2024, 3:11:50 PM (8 days ago) Jun 27
to ledge...@googlegroups.com
On 2024-06-26, Igbanam Ogbuluijah wrote:
> Hi all,
>
> Just wanted to bump this to see if anyone had any ideas yet.
>
> Thanks!
>

I think it's not related to budgeting, you're trying to filter postings
in an unusual way. What you're asking is probably possible, maybe
someone knows a nice solution, but I don't :)

I guess one way would be adding an automated transaction that just nulls
any relevant posting, I don't know, something like this:

= expr (account == 'Unpaid:Leave')
Benefits 1
Unpaid:Leave -1

If you're willing to record them differently, maybe a better solution is
to use different commodities, e.g.:

~ yearly
Leave 10 paid
Leave 5 unpaid
Benefits

Now you can do --limit 'commodity == "paid"' and get the output you wanted.

Hope this helps.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Igbanam Ogbuluijah

unread,
Jun 29, 2024, 10:13:58 AM (6 days ago) Jun 29
to ledge...@googlegroups.com
Rethinking the commodity works here. It's technically a leave day, not just a normal day.

While this solves my current use case, there may be a reason to filter out postings based on accounts

--

---
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/-XqJ5nLXevs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/v5kdhb%247er%241%40ciao.gmane.io.
Reply all
Reply to author
Forward
0 new messages