On 22/10/2022 19:49, Máté Farkas wrote:
With a small post-process step I can solve it with this BQL:

SELECT
    year, month, last(balance) as balance, last(getprice("CHF", "USD", date)) as price
WHERE
     account ~ 'Assets'
GROUP BY year, month
ORDER BY year, month

I think the convert() BQL function is what you are looking for. Something like the following may do what you ask for:

SELECT
  year,
  month,
  last(convert(balance, 'USD', date(year, month, 1))) AS balance
WHERE
  account ~ 'Assets'
GROUP BY
  year,
  month

adjusting the third parameter of convert() to do what you need (which is not very clear to me from the problem statement).

Cheers,
Dan

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a5e41be5-c835-a63b-9d7b-a769d2cbfca0%40grinta.net.

Reply via email to