Computing balances by tag rather than by year?

In my journal I use tags to identify transactions related to trips, for example trip:prague-24. Now I'd like to plot my expenses for each trip to compare them.

It would be helpful if there was a report which produced a table with accounts on rows and trips on columns, for example:

florence-22 madrid-23 prague-24
s:food 123 EUR 123 EUR 123 EUR
s:transport 123 EUR 123 EUR 123 EUR
s:hotel 123 EUR 123 EUR 123 EUR

This would be the same as hledger bal -Y but with balances computed by the value of the tag trip rather than by year.

Can hledger do this?

Not exactly. --pivot lets you replace or augment the account name with other fields ... but date is always one of the axes in our current reports.

I think the best you can do without custom scripting is to combine trips and expense categories in the account tree. Eg, assuming there's a trip tag,

hledger bal tag:trip --pivot trip::acct expenses

or

hledger bal tag:trip --pivot acct::trip expenses -t --drop 1

(The second colon is not required, it's just for a visual separator)

I agree it would be nice to support the kind of report you showed.

This is helpful, thank you!