Integrating credit card data into the ledger-file

Hi all,

I found this nice reddit post that explains almost everything that I need to know.

To re-use the example:

2020-12-29 TECHNIVORM MOCCAMASTER16250 SW 72ND AVE 8556622200 97224 OR USA - Technivorm Moccamaster
    expenses:applecard            $245.25
    liabilities:applecard        $-245.25

2020-12-31 AMZN MKTP - Amazon Marketplace
    expenses:amazon                $16.08
    liabilities:applecard         $-16.08

2021-01-01 SAFEWAY - Safeway
    expenses:groceries              $9.74
    liabilities:applecard          $-9.74

2021-12-31 ACH DEPOSIT INTERNET TRANSFER FROM ACCOUNT ENDING IN 0000 <---- this is the credit card bill payment BUT FROM THE EXPENSES LAST MONTH
    assets:bank:checking:my_bofa        $-540.87
    liabilities:applecard                $540.87

The last posting is the payment of the credit card bill, but from the previous month. So when I check the balance for a given month, it seems very hard to separate the actual expenses for the current month and the previous month.

How would that be achievable?

I have two options on my mind, but all seems flawed... so I am interested what the right way of getting the information is.

Best
Jonas

1 Like

I do not see the issue.

The balance should show the current state of your assets and liabilities. So, if you buy something but you owe money, you did not really pay, you will have liabilities and when you pay them you will not have liabilities but you will have less money in your assets. But at the end the net worth (assets - liabilities) show you the current state of your balance and is the same one done the expense (net worth of assets minus liabiliaties is the same than the net worth of assets once the payment of credit card is done).

hledger bal assets: liabilities:  # net worth, status of your personal finance

Furthermore, the income statement (expenses and revenues) are record when really happen, so to know the expenses of one month you should use:

hledger bal expenses: # expenses
hledger bal expenses: -p april # expenses in april
hledger bal expenses: revenues: -p april # results of the april month: revenues - expenses

Thanks for the reply.

Mhmm, I need to think about it.. this is all new to me.

But from my perspective, I am interested in the actual liabilities fo the current month, because the $540.87 are expenses from the previous month.

Maybe my misunderstanding is, that my credit-card-period ends in the middle of the month... so what I actually want is that period (e.g. from the 15.03.24 til 14.04.24; before the bill get's payed from my side), I guess...

To know what you spent (amt:'<0') with the applecard you could play with the next commands:

hledger balance liabilities:applecard amt:'<0' --monthly --begin 11.15
hledger register liabilities:applecard amt:'<0' --monthly --begin 11.15
1 Like

Another idea: though it’s slightly more bookkeeping work, if you want to partition each month’s activity you can always add month subacccounts, eg :202412.

This is good, but I noticed, that I am actually interested in the expenses+categories that belong to these liabilities… is that possible?

For context, I have one big ledger file, and only few expenses are payed with the credit card.

Thanks for the suggestion. However, I’m already committed to one ledger file per year… :slightly_smiling_face:

Try these:

hledger print liabilities:applecard | hledger -f - balance expenses: --monthly --begin 11.15
hledger print liabilities:applecard | hledger -f - register expenses: --monthly --begin 11.15

Ah, nice one! I am not (yet) used to this mental modal of piping hledger commands together, but getting there...

1 Like

Possibly even better is to match not on the account "expenses:" but match on "everything except payments", which involves hledger's "not" filter.

For now, those two might look like the same filter, but in the future, as things become more complicated, it might become easier to think of selecting "everything that isn't a payment".

1 Like

I haven't understood all of this thread, but I think there was a misunderstanding here - I didn't suggest multiple files.

I am actually interested in the expenses+categories that belong to these liabilities… is that possible?

Some more ideas that might be relevant to this:

  • Use -r/--related with balance/register
  • Use aregister liabilities:applecard

Sorry if this is irrelevant, but I basically use a different doc# for each statement. I just pull up the postings with that doc# for the ones that should be on that statement. (My system supports doc# classes. Ledger might do better with tags or something; I am new to it, as well.)

Another way may be to link a payment id with each posting it's paying...