I have expenses in one currency (EUR) and want to convert all of them
to another (USD) **on the day** of the transaction.
This gives the correct result because I pass "date" to CONVERT():
beancount> SELECT sum(convert(position, "USD", date)) WHERE account ~ '^Assets:A';
sum_conver
----------
107.50 USD
But I'd like to see a "register" type view with each individual
transaction and the total. Unfortunately, the only way I can
figure out is to convert the whole balance to USD, which gives
a different result to converting each transaction on the original
date:
beancount> SELECT position, convert(balance, "USD", date) WHERE account ~ '^Assets:A';
position convert_ba
----------------- ----------
20 EUR 22.00 USD
45 EUR {1.14 USD} 74.10 USD
30 EUR {1.14 USD} 108.30 USD
How can I see 107.50 here?
I tried something like
SELECT position, SUM(convert(position, "USD", date)) WHERE account ~ '^Assets:A';
but sum(position) doesn't do what I want when I look at
each transaction separately.
Test case:
plugin "beancount.plugins.implicit_prices"
2000-01-01 open Assets:A
2000-01-01 open Assets:B
2018-12-05 * "Test 1"
Assets:A 20 EUR @ 1.10 USD
Assets:B
2018-12-06 * "Test 2"
Assets:A 45 EUR {1.14 USD} @ 1.14 USD
Assets:B
2018-12-07 * "Test 3"
Assets:A 30 EUR {1.14 USD}
Assets:B
--
Martin Michlmayr
https://www.cyrius.com/