Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Partner
Partner

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
Highlighted
Partner
Partner

Re: avoid sum that count several time the value

Hi, I found the solution using

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

2 Replies
isingh30
Valued Contributor

Re: avoid sum that count several time the value

Like this -

y.PNG

Highlighted
Partner
Partner

Re: avoid sum that count several time the value

Hi, I found the solution using

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