GROUP BY just with one currency?

58 views
Skip to first unread message

Alexander Lazarević

unread,
Jan 2, 2024, 7:21:34 AM1/2/24
to bean...@googlegroups.com
I use something like this to get my daily expenses:

select date, sum(position) where account ~ 'Expense' group by date

This gives me something like this:

1986-01-01    2.33 EUR,  543.00 XYZ, 1697.00 UVW

Is there a way to get the daily expense just in one currency?

Viele Grüße,
 Alexander Lazarević

Martin Michlmayr

unread,
Jan 2, 2024, 9:42:39 AM1/2/24
to bean...@googlegroups.com
You can convert the position using something like this:
CONVERT(position, "EUR", date)

So the whole query would be:
select date, sum(CONVERT(position, "EUR", date)) where account ~ 'Expense' group by date

* Alexander Lazarević <alex...@lazarevic.de> [2024-01-02 17:45]:
> --
> 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 beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAMPYxd%3DYBZ1bJbBGojG97StFytAy6M9KEVHk_O8jdHYPq-cW_w%40mail.gmail.com.

--
Martin Michlmayr
https://www.cyrius.com/

Alexander Lazarević

unread,
Jan 2, 2024, 8:50:01 PM1/2/24
to bean...@googlegroups.com
Works perfectly! Thanks!

On Tue, 2 Jan 2024 at 21:42, Martin Michlmayr <t...@cyrius.com> wrote:
You can convert the position using something like this:
    CONVERT(position, "EUR", date)

So the whole query would be:
   select date, sum(CONVERT(position, "EUR", date)) where account ~ 'Expense' group by date
his group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages