Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Distinct in set analysis

I have some Orders and Amounts with duplicates:

Order Amount

A         1

A         1

B         2

C         1

I'm trying to write a function to calculate SUM(Amount) for different Orders. The result should be: 1+2+1=4. How should I do it in set analysis?

Thanks for help!

1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

try this

=sum(aggr( sum(Distinct [Order Amount]),Pro))

View solution in original post

8 Replies
Chanty4u
MVP
MVP

try

LOAD Distinct * INLINE [

Pro,    Order Amount

    A, 1

    A, 1

    B, 2

    C, 1

];

wanyunyang
Creator III
Creator III
Author

I'm not able to do this in data load script. Is it feasible in set analysis?

Chanty4u
MVP
MVP

looking for this?

sum(DISTINCT  [Order Amount])

wanyunyang
Creator III
Creator III
Author

Then it will count 1 only once. 1 should be counted twice, once for A once for C.

I'm trying to find something like: SUM({<DISTINCT Order>} Amount)

Chanty4u
MVP
MVP

try this

=sum(aggr( sum(Distinct [Order Amount]),Pro))

sunny_talwar

May be this

Sum(Aggr([Amount], Order))

Anonymous
Not applicable

Hi

Try below.

Table:

LOAD  * INLINE [

Pro,    Order Amount

    A, 1

    A, 1

    B, 2

    C, 1

];

FinalTable:

LOAD

[Order Amount],

Pro,

If(Pro <>Previous(Pro), 'NoDuplicate') as Flag

Resident Table;

DROP Table Table;

in front end  use :   =sum({<Flag={"NoDuplicate"}>} [Order Amount])

sasiparupudi1
Master III
Master III

Aggr(Sum(Amount),Order )