Bug 385900 - Report generates different sum values compared to the stable version
Summary: Report generates different sum values compared to the stable version
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-18 11:37 UTC by Ralf Habacker
Modified: 2022-12-19 20:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
test case (26.79 KB, text/xml)
2017-10-18 11:37 UTC, Ralf Habacker
Details
test case with the same results (4.94 KB, application/gzip)
2017-10-18 18:41 UTC, NSLW
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2017-10-18 11:37:42 UTC
Created attachment 108430 [details]
test case

Opening the appended test case with kmymoney from git master displays different sum value in the mentioned report.

How to reproduce ?
1. start kmymoney
2. load appended file
3. open report "Income and expense (convert to base currency)"

What happens ?
The report shows a sum of 344.528,63 AED

What is expected ? 
This value differs from the report generated with kmymoney from the 4.8 branch, which shows 344457,36 AED
Comment 1 NSLW 2017-10-18 16:08:54 UTC
(In reply to Ralf Habacker from comment #0)
> Created attachment 108430 [details]
> test case
> 
> Opening the appended test case with kmymoney from git master displays
> different sum value in the mentioned report.
> 
> How to reproduce ?
> 1. start kmymoney
> 2. load appended file
> 3. open report "Income and expense (convert to base currency)"
> 
> What happens ?
> The report shows a sum of 344.528,63 AED
> 
> What is expected ? 
> This value differs from the report generated with kmymoney from the 4.8
> branch, which shows 344457,36 AED

It seems like bug and that 344457,36 AED is correct, but please be carefull here because there was other bug with currencies conversions which has been fixed and I think it might have introduced bug here.
If you're going to fix this, then please write test case also. I'll try to find the other bug and probably write test case for it as well.
Comment 2 NSLW 2017-10-18 18:41:12 UTC
Created attachment 108443 [details]
test case with the same results

There is this bug #118159 and I think it might have "fix" too much of stuff but I'm not sure.

What I mean is: 
1) Why do you convert from EGP to AED (on 11/10/16 and 11/13/16) if you in fact hold EGP all the time?

2) Then there is this test case, I've modified a little bit. I hold EGP all the time and open report which outputs the same sum i.e. 344.528,63 AED while in my opinion it should report 344457,36 AED.

Maybe I'm missing something here and someone could explain how it should be in the end.
Comment 3 Ralf Habacker 2017-10-18 21:43:02 UTC
(In reply to NSLW from comment #2)
> Created attachment 108443 [details]
> test case with the same results
> 
> There is this bug #118159 and I think it might have "fix" too much of stuff
> but I'm not sure.
> 
> What I mean is: 
> 1) Why do you convert from EGP to AED (on 11/10/16 and 11/13/16) if you in
> fact hold EGP all the time?
the test case has been constructed from a kmymoney file with data collected from several years, especial many price entries. See bug 385857 for more details.
Comment 4 Ralf Habacker 2017-10-19 10:37:30 UTC
It looks that kmymoney5 changes the calculation for report intervals compared to the stable version

With attachment 108451 [details] from bug 385857 the stable version performs for monthly reports the following conversations (copied from bug 385857 comment 10)
> Debug:date QDate("Mi Nov 30 2016") conversionfactor 4.89 oldvalue 832588 new value 170263 

while git master uses 
Debug:date QDate("2016-11-01") conversionfactor 2.4172 oldvalue 832588 new value 344443

stable seems to collect all entries for a given month and uses the price of the last day of month while git master uses the price of the first day in month, which may also be incorrect.
Comment 5 Justin Zobel 2022-11-30 05:28:14 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 6 Bug Janitor Service 2022-12-15 05:13:26 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Jack 2022-12-19 20:59:54 UTC
I've dug through this and the related bugs.  Current 5.1 and master  both show the sum of 344.528,63 AED which seems to be incorrect, with the underlying cause that the pivot table in the report sums all the values in a cell (month) before converting the currency.  In my view, whether that conversion is then done with an earlier or later conversion rate is still going to get a value different than if each contributing value is converted separately (assuming rates are available on each transaction date, as is the case here.
I'm restoring to REPORTED, although I'm not sure I agree that 344457,36 AED is correct either.
Whatever the decision, I think it needs to be made more obvious to the user how and when currency conversions are done in various reports.  This certainly needs to be in the handbook, but also as some sort of note in the Reports View itself.
I still have an underlying question of whether currency conversions should always be done per transaction in reports with longer granularity (month, year, ...) or if it is ok to do the conversion per time period, and if so, with which conversion rate?