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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum distinct CustomerID

Hi All,

i am sitting with a requirement to write:

the sum of Revenue where Customer ID is equal to Distinct

but have no idea how to tackle this one, any help would be accepted.

Thanks.

11 Replies
sunny_talwar

Would you be able to share some data to see what you are trying to accomplish?

prma7799
Master III
Master III

What you actually want. Can you elaborate more?

avinashelite

may be like this:

if (count(Customer ID)=1,sum(Revenue ))

if this doesn't give the desired result , then you  need check the count in the SQL i.e in the script level and set a flag for the same. Finally based on the flag value you can calculate the sum

tresesco
MVP
MVP

May be like:

Sum({<[Customer ID={"=Count([Customer ID])=1"}]>}Revenue)

Anonymous
Not applicable
Author

hi

maybe:

sum(aggr(sum(DISTINCT Revenue), Customer ID))

Not applicable
Author

Hi All,

im trying to implement most Solutions you guys are giving me,

one more thing that i want is: Distinct CustID and Number of Revenues made each distinct CustID Made.

Thanks.

sunny_talwar

Alternative to this could be:

=Sum(Aggr(Only(Revenue), CustID)) or

=Sum(Aggr(Avg(Revenue), CustID))

avinashelite

yes, count(Customer ID)=1 will give you you the Distinct custID....once this condition is satisfied..for the distinct Custid you will get the sum 

tresesco
MVP
MVP

Try:

Straight table:

Dim: [Customer ID]

Exp: Sum({<[Customer ID={"=Count([Customer ID])=1"}]>}Revenue)