Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expense graph over time and "Convert to <currency>" behavior #1936

Open
lutorm opened this issue Jan 3, 2025 · 0 comments
Open

Expense graph over time and "Convert to <currency>" behavior #1936

lutorm opened this issue Jan 3, 2025 · 0 comments

Comments

@lutorm
Copy link

lutorm commented Jan 3, 2025

It seems the cumulative expense graph that is displayed when you go to the Expenses tab and then click on an account does not handle currency conversion correctly.

This is what our grocery expenses look like over time, converted to SEK:
Screenshot_20250103_105811
As you can see, it is not cumulative. Sometimes the total expenses appear to decrease. I believe what's happening here is that fava (or beancount, I don't know where the calculation is done) accumulates our grocery expenses in USD and SEK separately and then, for each point on the graph, converts the USD value to SEK and adds them. This means that if we have an accumulated expense of 10,000 USD in Jan 2025 and the exchange rate changes such that those USD are now worth less SEK, the expense line will decrease.

This seems like a useless way of doing the currency conversion since those USD were spent at some time in the past, and just because USD is worth less right now doesn't mean that our expenses back at that time changed. I think a more useful way of doing the calculation is that, for each interval, the USD value is converted to SEK using the exchange rate at that point in time, and then the running sum of SEK is displayed.

Ie, instead of plotting, in pseudocode,
y(T)=Sum(USD(t),0,T)*(SEK/USD)(T) + Sum(SEK(t),0,T),
the plot should be
y(T)=Sum(USD(t)*(SEK/USD)(t)+SEK(t),0,T).

I'm doing this with fava 1.29 on Chrome 131.0.6778.139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant