Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Wolfmeyn
Contributor
Contributor

Count multiple values per customer

hi i have these 6 datapoints in QlikSense

mas.customer_ID (is customer id)

ex.blocked_1 (this is either 0 or 1 or null)

ex.blocked_2 (this is either 0 or 1 or null)

ex.blocked_3 (this is either 0 or 1 or null)

ex.blocked_4 (this is either 0 or 1 or null)

ex.blocked_5 (this is either 0 or 1 or null)

i want to make a count field per customer id that counts all ex_blocked fields if they have value 1 and then turns me the number of how many blocked they have? Where should the count be made ? in the data load editor or in the sheets?

 

Labels (7)
1 Reply
Sayed_Mannan
Creator
Creator

Hi, You can create a new field in the data load editor that sums up all the ex.blocked fields for each customer_ID.

Try this:-


LOAD
mas.customer_ID,
If(ex.blocked_1 = 1, 1, 0) +
If(ex.blocked_2 = 1, 1, 0) +
If(ex.blocked_3 = 1, 1, 0) +
If(ex.blocked_4 = 1, 1, 0) +
If(ex.blocked_5 = 1, 1, 0) as Total_Blocked
FROM [YourDataSource];

here replace [YourDataSource] with the name of your data source. The If() function checks if each ex.blocked field is equal to 1 (which means blocked), and if so, it counts it as 1 otherwise, it counts it as 0. The Total_Blocked field now contains the total number of blocked fields for each customer_ID.

Then, in your sheet, you can simply use the Count() function to count the Total_Blocked field for each customer_ID. This will give you the number of customers who have a certain number of blocked fields.

I hope this helps! if it resolve your issue please mark this as a solution.