Hledger helps with travel

In this week's blog, I look at

  • Why an item purchased during travel wasn't a travel expense
  • Sorting expenses by amount
  • Upgrading hledger

And I tie them together with a reference to a recent trip.

Read more at https://hledgerfan.com/hledger-and-travel-expenses/.

1 Like

Thanks for your post.

Have you considered keeping all your transactions as you typically would but use tags?

for example, this is how i would record a non-travel transaction:

2025-06-20 Target
    expenses:home:clothing:shirts          $12.99
    expenses:taxes:ca:sales                 $1.12
    assets:bank:checking                  $-14.11

and the only difference if i had purchased it on a travel trip would be to add a tag:

2025-06-20 Target
    expenses:home:clothing:shirts          $12.99 ;sandiego_summer2025:
    expenses:taxes:ca:sales                 $1.12
    assets:bank:checking                  $-14.11

With this, i can see how much (or little) i spent on a trip with a given tag:

$ hledger bal tag:sandiego_2025
         $12.9900000  expenses:home:clothing:shirts
--------------------
         $12.9900000

I tag all expenses related to toe travel/vacation with tags - airfare, taxi, clothing, food, tips, lodging, fuel, etc.

With a generic travel category, how do you determine how much you spent on your San Diego trip vs. Santa Barbara trip?

info on tags:

Actually I should tag the account, so that it will get everything and not just the category:

2025-06-20 Target ;sandiego_2025:
    expenses:home:clothing:shirts          $12.99
    expenses:taxes:ca:sales                 $1.12
    assets:bank:checking                  $-14.11
$ hledger bal tag:sandiego_2025
        $-14.1100000  assets:bank:checking
         $12.9900000  expenses:home:clothing:shirts
          $1.1200000  expenses:taxes:ca:sales
--------------------
                   0
1 Like

Yes, tags can be a great help. I used to combine tags with a travel category. That is, any travel would be under my travel category. Then, there would be a tag to identify the individual trip.

This worked well, except that I found that I wasn't using the information about individual trips. That is, I wasn't running reports to see how much an individual trip cost. So, I stopped adding tags to denote the specific trip.

However, I can easily imagine situations where someone would find identifying separate trips quite useful!

1 Like

I have been debating whether to categorize shopping under travel expenses or general expenses. This post has helped me decide that it should not be a travel expense. :slight_smile:

Additionally, I do something similar with my travel expenses. Except my tag looks like trip:2025_03_japan. This allows me to pivot on the trip tag to get an automatic breakdown by trip.

Example:

2025-05-27 Hotel  ; trip:2025_03_japan
    liabilities:credit_card             $-87.00
    expenses:travel:hotel            $87.00

2025-05-27 Airfare  ; trip:2025_02_spain
    liabilities:credit_card             $-125.00
    expenses:travel:hotel            $125.00

Then running the command

$ hledger bal expenses:travel --pivot=trip

             $125.00  2025_02_spain
              $87.00  2025_03_japan
--------------------
             $212.00  

And if I want a breakdown of expenses for a specific trip, I can do that easily too.

$ hledger bal tag:"trip=2025_03_japan"

Good example, sld!

I do this to! My tag format is a bit different but essentially the same: YYYYMMdestination (as in 202502barcelona or 202503japan for examples).

I love how useful and easy it is to see the total cost of a trip. I can also quickly see how much I have spent on a given category (such as restaurants) for any given trips.

I seem to do both:

  • I use a trip: tag, but with colon-separated values which lets me summarise by year or place: trip: 2024:ireland:galway
    hledger bal --pivot trip -2
  • I also have an expenses:travel account, with about a dozen subcategories. For me those trip expenses are enough of a different category that I want to see them broken out in reports.
1 Like

Okay I'm convinced and I'll use a travel category and tags...now I just need to go on a trip to make use of all this.

Recording the geo location of expenses is also fun application of PTA travel journals (pun intended).

2019-05-01 'Ice cream at Helsinki's market square
  # location: geo:60.167,24.955,5
  Expenses:Ice_cream  2.50 €
  Assets:Cash