Bug 330944 - Category filter in reports doesn't work with split transactions
Summary: Category filter in reports doesn't work with split transactions
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.4
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-09 08:53 UTC by Francois Marier
Modified: 2019-02-07 07:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Minimal example demonstrating the bug (4.83 KB, application/x-kmymoney)
2014-02-09 08:55 UTC, Francois Marier
Details
File to illustrate Alvaro's explanation (4.88 KB, application/gzip)
2014-10-18 16:03 UTC, Cristian Oneț
Details
Transactions by category example (5.03 KB, application/gzip)
2014-10-19 06:09 UTC, Cristian Oneț
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Marier 2014-02-09 08:53:14 UTC
When filtering by category in a Transactions report, split transactions are not handled correctly. 

Instead of only showing the matching sub-transactions in a split transaction, the whole transaction (with all of its sub-transactions) is included as long as one of the sub-transactions matches.

Reproducible: Always

Steps to Reproduce:
1. Create a new account with three transactions: one food withdrawal, one fuel withdrawal and one split transaction which has both fuel and food.
2. Create a new report which shows only food transactions from this account (filter by category).
Actual Results:  
The report includes the pure food transaction as well as the full split transaction (food and fuel). The only transaction that is excluded is the pure fuel transaction.

Expected Results:  
The report should include the pure food transaction and only the food part of the split transaction.
Comment 1 Francois Marier 2014-02-09 08:55:18 UTC
Created attachment 85058 [details]
Minimal example demonstrating the bug

Here's a minimal .kmy file which demonstrates this problem.

Look for the report I prepared under "Favorite Reports".
Comment 2 Alvaro Soliverez 2014-02-09 12:26:25 UTC
This was visited before. The whole transaction is shown by design, to
provide a report which keeps double-entry consistency.
Please try the reports by category, with full details disabled. Sorry I
cannot provide more help but I'm away from home at the moment.
 El 09/02/2014 05:53, "Francois Marier" <francois@fmarier.org> escribió:

> https://bugs.kde.org/show_bug.cgi?id=330944
>
>             Bug ID: 330944
>            Summary: Category filter in reports doesn't work with split
>                     transactions
>     Classification: Unclassified
>            Product: kmymoney4
>            Version: 4.6.4
>           Platform: Debian unstable
>                 OS: Linux
>             Status: UNCONFIRMED
>           Severity: normal
>           Priority: NOR
>          Component: general
>           Assignee: kmymoney-devel@kde.org
>           Reporter: francois@fmarier.org
>
> When filtering by category in a Transactions report, split transactions
> are not
> handled correctly.
>
> Instead of only showing the matching sub-transactions in a split
> transaction,
> the whole transaction (with all of its sub-transactions) is included as
> long as
> one of the sub-transactions matches.
>
> Reproducible: Always
>
> Steps to Reproduce:
> 1. Create a new account with three transactions: one food withdrawal, one
> fuel
> withdrawal and one split transaction which has both fuel and food.
> 2. Create a new report which shows only food transactions from this account
> (filter by category).
> Actual Results:
> The report includes the pure food transaction as well as the full split
> transaction (food and fuel). The only transaction that is excluded is the
> pure
> fuel transaction.
>
> Expected Results:
> The report should include the pure food transaction and only the food part
> of
> the split transaction.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel@kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
>
Comment 3 Francois Marier 2014-02-09 20:43:05 UTC
I've tried a category report with full details of split transactions disabled, but the problem is that the full amount (including the sub-transactions that don't match the text filter) shows up in the report and in the total.
Comment 4 Alvaro Soliverez 2014-02-09 22:49:29 UTC
For that kind of information, please use the Reports by Category
El 09/02/2014 17:43, "Francois Marier" <francois@fmarier.org> escribió:

> https://bugs.kde.org/show_bug.cgi?id=330944
>
> --- Comment #3 from Francois Marier <francois@fmarier.org> ---
> I've tried a category report with full details of split transactions
> disabled,
> but the problem is that the full amount (including the sub-transactions
> that
> don't match the text filter) shows up in the report and in the total.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel@kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
>
Comment 5 Francois Marier 2014-02-10 07:41:35 UTC
Ok, I can see what you mean now. In the file attached to this bug, I can do this:

1. open the report and click "Configure"
2. go to the "Rows/Columns" tab
3. change the "Organize by" value from "Month" to "Categories"

and the report no longer shows the sub-transactions that don't match the filter.

So I should qualify this bug further and say that: the filter doesn't work with split transactions, unless the report is organized by category.

Is there a reason why I would want to filter out certain categories but not if they are within split transactions? That doesn't make sense to me. I mean I would either want:

(a) all transactions, split or not regardless of the categories; or
(b) only the transactions (or sub-transactions) that match a given category filter

In other words, I don't understand the use case for having a way to filter based on category and only apply it to one type of transactions (the non-split ones).
Comment 6 Alvaro Soliverez 2014-02-10 11:01:41 UTC
No, that's not what I mean. The base report you start with, has to be one by category.

eg. Income and Expenses report.
Comment 7 Francois Marier 2014-02-10 11:45:38 UTC
I did some more testing with reports of type "Transactions" and if I organize the report by Categories, Top Categories or Payees, then the category filter is applied properly. If I organize the report by Accounts, Top Accounts, Month or Week, then the filter is not applied to split transactions.

I don't understand what you mean when you say to start with a report by category and then you give "Income and Expenses" as an example. If I look under Reports | Income and Expenses, I only see these reports:

- Income and Expenses By Year
- Income and Expenses Graph
- Income and Expenses Pie Chart
- Income and Expenses This Month
- Income and Expenses This Year

There is no mention of the word "category" in the above. If I use one of the above Income and Expenses report, I can filter by category and the filter is applied properly to split and non-split transactions. However, I can't see individual transactions, just a total for each category.
Comment 8 Alvaro Soliverez 2014-02-10 14:34:23 UTC
Categories are actually the Income and Expenses accounts, that's why I offered that example.

For what you want, with detailed transactions, you want to use the Transactions by Category reports.

If you use the transactions by account report, it will use the category filter to match transactions, but the amount is the one on the account split, therefore, the total amount and not just the one of the category.

This behavior is by design. I'll try to put a more detailed example of how it works later.

PS. Please apologize my brief answers, I've been away from my PC for the whole week, with only a tablet to check emails.
Comment 9 Cristian Oneț 2014-09-24 14:03:28 UTC
Did Alvaro's explanation make sense? If not please continue the discussions and maybe create a wishlist item since the current behavior was designed this way.
Comment 10 Francois Marier 2014-10-11 00:45:20 UTC
It sounds like the behaviour I'm seeing is intended and that maybe I need to use a different report type, however, I don't understand the report that Alvaro is describing.

Here's my exact use case and how I've been able to work-around this behaviour in the split transactions.

Goal: extract shared food expenses out of my credit card account (to be reimbursed by flatmates)

1. create a report as described in the bug description
2. export the report to CSV
3. open the CSV report in LibreOffice
4. for each split transaction, change the total of the transaction to $0
5. take the total of the expense column

Now, if the report within kmymoney could avoid showing the full transaction amount for split transactions and instead only show the parts of the transaction that match the filter, then I could use the total in the kmymoney report directly and not have to do the export to LibreOffice.
Comment 11 Cristian Oneț 2014-10-18 16:03:09 UTC
Created attachment 89189 [details]
File to illustrate Alvaro's explanation

Please checkout this file to see what Alvaro meant. Both reports can be found as favorite reports.
1. Roomate expense - Income and expense report (also found under that category) is what you need and what Alvaro suggested
2. Rmomate expense wrong - Transactions report (also found under that category) is what you tried and it's not what you need because that report will always show all splits
Comment 12 Cristian Oneț 2014-10-18 16:03:54 UTC
Please get back to us if using the proper report solves your problem.
Comment 13 Francois Marier 2014-10-19 00:52:38 UTC
Thanks for the example Cristian, it does make this much clearer. I'm sorry if it's taken me a while to understand fully this issue, I'm just an amateur book keeper :)

I have changed my report to be the same one as you had in that example file (Income & Expenses). The downside of that approach however is that the report no longer shows the details of each transaction. It only shows the total amount for each category.

Now, in the above flatmate use case, the level of details is too low. They will want to see individual transactions to make sure that they're not getting ripped off by me :)

That's why I initially went for a transactions report. Maybe what I should have filed is a wishlist bug to add a reporting option to the transaction reports?
Comment 14 Alvaro Soliverez 2014-10-19 03:08:18 UTC
Did you try the Transactions by Category report?
It's similar to the Income and Expenses but it shows details per transaction.
Comment 15 Cristian Oneț 2014-10-19 06:09:30 UTC
Created attachment 89194 [details]
Transactions by category example

The "Roommate with details"  report in this file shows the "Transactions by category" report mentioned by Alvaro.
Comment 16 Cristian Oneț 2014-10-19 06:11:32 UTC
Please see the attached report.
Comment 17 Francois Marier 2014-10-19 07:50:02 UTC
Ah, that last example is exactly what I was looking for. Sorry it took me so long to finally get it.

Thanks so much for your help Cristian & Alvaro! kmymoney rocks.
Comment 18 Cristian Oneț 2014-10-19 07:52:36 UTC
(In reply to Francois Marier from comment #17)
> Ah, that last example is exactly what I was looking for. Sorry it took me so
> long to finally get it.
> 
> Thanks so much for your help Cristian & Alvaro! kmymoney rocks.

No problem, you're welcome :).
Comment 19 Ralf Habacker 2018-06-13 19:38:16 UTC
Retested with 4.8.2 and no issue found