Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

avoid sum that count several time the value

Hi Qlikers,

I have to tables. in the first one there each line has a unique ID

IDSales
A10
B20
C10
D30

In the second one for each ID I can have several attributes

IDAttribute
ALOW
AMID
BLOW
BMID
BHIGH
CMID
CHIGH
DMID
DMID
DHIGH

if I use this formula: count(distinct(if(Attribute='MID',ID))) result is 4

but if I use formula sum(distinct(if(Attribute='MID',Sales))) result is 60 (but I would like to find 70)

and if I use formula sum(if(Attribute='MID',Sales)) result is 100 (because I have two lines with MID for ID=D)

what would be the syntax in order to only sum once each line in my first table ?

Thanks for your help

1 Solution

Accepted Solutions
reivax31
Partner - Creator III
Partner - Creator III
Author

Hi, I found the solution using

sum(aggr(if(Attribute='MID',Sales),ID))

View solution in original post

2 Replies
isingh30
Specialist
Specialist

Like this -

y.PNG

reivax31
Partner - Creator III
Partner - Creator III
Author

Hi, I found the solution using

sum(aggr(if(Attribute='MID',Sales),ID))