Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Sum IF with Distinct

I have the following columns of data:

1) Customer_ID

2) Service_Date

3) Service_Count

4) Location_Code

5) Service_ID

I need to add the Service_Count for Customer_IDs with DISTINCT Customer_ID & Service_Date, IF the Location_Code is 23.

How can I write an expression for this?

I originally had

Sum( If( Location_Code = '23', Service_Count, ))

Obviously this is incorrect, but did not know how to add the DISTINCT clause.

Any help is greatly appreciated.

1 Solution

Accepted Solutions
Highlighted

May be try this:

Sum({<Location_Code = {23}>} Aggr(Sum(DISTINCT {<Location_Code = {23}>} Service_Count), Customer_ID, Service_Date))

View solution in original post

3 Replies
Highlighted

May be try this:

Sum({<Location_Code = {23}>} Aggr(Sum(DISTINCT {<Location_Code = {23}>} Service_Count), Customer_ID, Service_Date))

View solution in original post

Highlighted
Not applicable

THank you, this worked perfectly.

Highlighted

Awesome