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: 
rasmusnielsen
Partner - Creator
Partner - Creator

Totals should account for duplicates

Hi guys,

My data looks like:

Screenshot 2024-09-03 at 11.00.28.png

A single transaction is made up of some volume number and 1 or more payment IDs

My table show have a row per transaction and payment ID, where the volume is "duplicated" for each payment ID of the transaction. But the totals should account for this and only sum up the transaction volume and thus ignore "duplicated" entries. I my table above, I average the volume for the transaction to account for the "duplicated" volume.

In the table above, I would like the rows to have the values of the last column, but the total to be that of the 2nd last column. If I add nodistint to the Aggr function, I get the expected row values, but the total will be wrong. Also tried changing the totals function from auto to sum, but it did not help.

Any hints on how to solve this?

Thanks

Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda

@rasmusnielsen  you can probably change the expression for total using dimensionality()

if(Dimensionality()=0,sum(aggr( sum(distinct Volume),TransactionID)), sum(Volume))

View solution in original post

5 Replies
Kushal_Chawda

@rasmusnielsen  You can use sum(distinct Volume) with aggr function. Try something below

=sum(aggr( sum(distinct Volume),TransactionID))

 

kevincase
Creator II
Creator II

Based on your dimensions, this is how Qlik works.  If you want to limit the data, flag the rows you want to display in your load script.

rasmusnielsen
Partner - Creator
Partner - Creator
Author

@Kushal_Chawda That gives me the same result as my initial approach with avg

Screenshot 2024-09-03 at 12.49.48.png

Kushal_Chawda

@rasmusnielsen  you can probably change the expression for total using dimensionality()

if(Dimensionality()=0,sum(aggr( sum(distinct Volume),TransactionID)), sum(Volume))

rasmusnielsen
Partner - Creator
Partner - Creator
Author

@Kushal_Chawda Thanks, that did the trick: 

Screenshot 2024-09-03 at 13.12.02.png