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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
lg92
Contributor II
Contributor II

Sum Price Distinct ID Price For Group

Hi,

I have this field from different Tables

 

ID TEXT       Par    Price   ID Price
1                     P1       80          A
1                    P2        80          A
1                    P3        20          B 
1                    P4        80          C
1                    P5        40          D 
1                    P6        50          E
1                    P7        60          F
2                    P1        80         A
2                    P2        80         A
2                    P3        20         B
2                    P4        80         C
2                    P5        40         D
2                    P6        50         E
3                    P1        80         A
3                    P2        80        A
3                   P3         20        B
3                   P4         80        C

I would like to calculate the sum of the price without repetitions of ID Price for single ID Text.

In this case will be 780

I've tried this

SUM( aggr (Price,ID TEXT&ID Price))) but doesn't work

Thanks in advanced

Labels (1)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

You were close.  You need to add an aggregation function, like Only() in the aggr() function.

Try this:

sum(aggr(only(Price),[ID TEXT],[ID Price]))

View solution in original post

1 Reply
GaryGiles
Specialist
Specialist

You were close.  You need to add an aggregation function, like Only() in the aggr() function.

Try this:

sum(aggr(only(Price),[ID TEXT],[ID Price]))