Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
VT
Contributor
Contributor

Incorrect sum

Hi, 

I have a somewhat bizarre problem: The total is not correct. I have two separate payments of 400 each. the total shows me 400 instead of 800. I added a rowno () field to be sure that the two lines are very distinct.

Anyone know how to fix this?

Capture000.PNG

 

Labels (1)
8 Replies
Ivan_Bozov
Luminary
Luminary

In the settings for this column there is a "Totals function" drop-down. Select Sum.

vizmind.eu
Vegar
MVP
MVP

I assume that the rowno that you created is not in the same table as the Payment amount that you are using in your sum expression.

Consider this script. The total amout is 400 not 800, and the 400 is associated to both the two detail rows.

 

Payment:
LOAD * inline [
FACT_NUM,    P..., Payment Date, Payment amount
26000005165, BNS,  08/03/2017,   400
];

Payment_row:
LOAD * inline [
FACT_NUM,    PMT_ROWNO, Item
26000005165, 1087898, Item A
26000005165, 1087899, Item B];

 

 

But if you still want to display this as 800 then you should as @Ivan_Bozov  suggested, let your measure total aggregation to be sum or rows and not sum total. 

Vegar_1-1588531836585.png

 

 

VT
Contributor
Contributor
Author

Hi, thanks for answerinf. 

 

Ok it works with straitch table but when i use a set analysis i still have the same problem (i've created table just to explain the problem). 

Capture001.PNG

Thanks in advance

VT
Contributor
Contributor
Author

hi, 

 

Thanks for answering. 

 

the rowno is in the same table. It's a payment table with a few milons of rows. I have this problem with only 13 payments and i can't find the reason. 

 

 

Ivan_Bozov
Luminary
Luminary

Then I assume, and this is also what @Vegar  suggested, that this payment of 400 is associated to multiple fields from another table, e.g. item description. Try removing all columns from the table one by one to see what causes the duplicate (only leave FACT_NUM and Payment Amount).

Also, did you create the RowNo() line in the straight table or is it part of the database?

vizmind.eu
Vegar
MVP
MVP

Are all fields in the table and the field used for creating the calculation from the same single source table in the data model? Please double check.

VT
Contributor
Contributor
Author

Yes it's the same table and the the rowno is added on the load.

I think you understand my problem inside out. In fact, I don't have a double payment but a duplicate payment. There are two separate payments in the database. the problem is that only one payment is recorded when I use a set analysis as if I used "distinct".
The good amound in the database for this exemple is 3.085,18 but when i use set analysis or just simple sum i got 2.685,18 so the difference is 400. 

robert99
Specialist III
Specialist III