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: 
Not applicable

Sum (Amount) for distinct field

Hi all,

I have the following table

token, amount

A,10

A,10

B,20

C,30

and I would calculate total of distinct token, i.e. 10+20+30 = 60 instead of 70

How should I do it?

Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Try...

Sum(DISTINCT amount)

View solution in original post

6 Replies
Not applicable
Author

Try...

Sum(DISTINCT amount)

Not applicable
Author

yes. Use the Distinct function in your expression.

=Sum(Distinct amount) and token as dimension

Not applicable
Author

If you can load distinct values i suggest you to load the distinct values by using distinct keyword in the script. If you can't load distinct values you can use the expression like sum(Aggr(DISTINCT amount,token)) as there might me same amount mapped to different tokens which will give wrong result if you use sum(distinct amount).

jsingh71
Partner - Specialist
Partner - Specialist

find attachment.

Not applicable
Author

hi

sum( DISTINCT amount)

Not applicable
Author

Hi,

You can do it in expression by using Sum(DISTINCT amount) as expression.

Might be something like attached.

Hope this helps!