Inconsistent filtering behaviour
Hi,
I have been using Fava for a few months and have found it to be very useful. However, I am struggling to understand some of the filtering behaviour, and have found it to be inconsistent and unintuitive. I would really appreciate it if someone could tell me where I am going wrong, or if this is intended behaviour. Thanks!
I'm using Fava 1.30 and Chrome 134.0.6998.178.
Expected Filtering Behaviour
I use the Go to account feature to navigate to an arbitrary account page. I filter the transactions by an arbitrary time period, account, tags, and payees. My expectation is that for ANY combination of account and filters, the data on the page corresponds ONLY to transactions which match the filters, and the data shown in the graphs and the table match.
Real Filtering Behaviour
In all cases I have found that the transactions displayed in the table have been filtered correctly. However, I have found the derived data on the page to be inconsistent between account types (Assets, Income etc), between filtering type (time, tag etc), and also between the type of time filtering. To make it easier to explain I will use the following tests, which should be true if the filtering behaviour is as I expect:
- The value in the
Price / Balancecolumn for the most recent transaction is equal to the sum of the filtered transactions. In other words, only the filtered transactions are contributing to the sum in thePrice / Balancecolumn. - The
Account Balancegraph starts at zero, since transactions before the selected time period are excluded. - The sum of all the bars on the
Changesgraph is equal to the sum of the filtered transactions.
Inconsistencies:
- Between account types: If I filter the account page for an
Incomeor anExpensesaccount, then tests 1-3 are true. This is the behaviour I expect. In fact, I never have any issues at all when filtering these accounts. However, if I apply a simple time filter to anAssetsorLiabilitiesaccount then tests 1,2 are false and test 3 is true - the lower bound on the time filter is ignored when the balances are calculated, even though the lower bound is applied to the transactions presented in the table. I'm not sure of any good reason for this to be the case. - Between filtering type: When I first found that a time-filtered
AssetsorLiabilitiesaccount ignored the lower bound, I assumed that this was so that the total balance of the account was always displayed in thePrice / Balancecolumn and so all filters were ignored equally. However, filtering by account/tag/payee impacts the values in thePrice / Balancecolumn and theAccount Balancegraph. I.e. transactions filtered out by time SOMETIMES contribute to the data presented but transactions filtered out by account/tag/payee are always completely removed. Again, in this case tests 1,2 are false and test 3 is true. - Between the type of time filtering: In time-filtered
AssetsorLiabilitiesaccounts, the behaviour of theChangesgraph differs depending on the time filter. In general, if I use years or months e.g.2024or2024-04 - 2025-04, then test 3 is true. However, in some cases when I use days e.g.2024-04-06 - 2025-04-05, test 3 becomes false - the first bar in the graph has the entire initial balance of the account added to it. I don't know why this is and I can't recreate it consistently, it just happens with certain time filters onAssetsandLiabilitiesaccounts. I've attached an example below - changing the filter by one day results in completely different graphs, even though the filtered transaction is the same. In this case, all of tests 1-3 are false!
A real example:
I want to see how much money I have paid into my ISA over the last tax year. This is important in the UK because you cannot go over the ISA allowance of £20,000. I navigate to my ISA account page. I filter the time to 2024-04-06 - 2025-04-05 (the UK tax year). The Changes graph is not useful because the first bar is not correct. The Price / Balance column and the Account Balance graph are not useful because they tell me my balance rather than the total of the transactions over the tax year (which is also confusing because I was just on an Income account which DID tell me my transactions over the tax year). I resort to looking at every transaction and using a calculator. I know that I could probably write a query or some other code to do the job, but the point is that I want to do it quickly in a GUI!
I feel like I am missing something. Any input or advice would be appreciated!
My expectation is that for ANY combination of account and filters, the data on the page corresponds ONLY to transactions which match the filters, and the data shown in the graphs and the table match.
This is true for the account filter and the generic filter but not quite true for the time filter. The time filter also leads to the entries to be "clamped" to the chosen time period. This is how that's documented in Beancount (https://github.com/beancount/beancount/blob/86b61ebba57e0d0377fab1031389a84dd3f8680c/beancount/ops/summarize.py#L229):
Filter entries to include only those during a specified time period. Firstly, this method will transfer all balances for the income and expense accounts occurring before the given period begin date to the 'account_earnings' account (earnings before the period, or "retained earnings") and summarize all of the transactions before that date against the 'account_opening' account (usually "opening balances"). The resulting income and expense accounts should have no transactions (since their balances have been transferred out and summarization of zero balances should not add any transactions). Secondly, all the entries after the period end date will be truncated and a conversion entry will be added for the resulting transactions that reflect changes occurring between the beginning and end of the exercise period. The resulting balance of all account should be empty.
If you look at the journal with an active time filter (e.g. https://fava.pythonanywhere.com/example-beancount-file/journal/?time=2016), you can see these generation summarisation transactions if you activate the x type of transactions. This is so that you can filter to a time period and still get your correct account balances (for the balance sheet accounts). Seems this is not documented in the help pages yet, will probably create a PR to add that soon.
However, in some cases when I use days e.g. 2024-04-06 - 2025-04-05, test 3 becomes false - the first bar in the graph has the entire initial balance of the account added to it.
That looks like a bug, yes. I think this happens if the time filter does not align with intervals (e.g. months). On generating the charts, the full intervals will be considered so e.g. on https://fava.pythonanywhere.com/example-beancount-file/journal/?time=2016-01-03+-+2016 the summarisation entry on 2016-01-02 ends up in the January bar.
That looks like a bug, yes. I think this happens if the time filter does not align with intervals (e.g. months).
This is fixed in #2024
I want to see how much money I have paid into my ISA over the last tax year. This is important in the UK because you cannot go over the ISA allowance of £20,000.
For this sort of thing I'd recommend creating per-year accounts (e.g. Assets:2025:ISA or Assets:ISA:2025) to allow reporting on a per-year level.