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