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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
GreskeB
Contributor
Contributor

use if-statement in a count function

Hi, 

I make a If-function to generate a value in a kolom in the table. Now I want to count how many times value a is generated en how many value B is generated. For example I generated the modulo from how many a buyer buy (Sales) and how many of this item are in a box (Packages). When modulo is equal to zero than the value is a otherwise it will be value b. 

item            modulo
1                   a
2                   a
3                   b

So i thought that I can use the next function: count (if(mod(Sales, Packages)=0, 'a', 'b')='a') or count (if(mod(Sales, Packages)=0, 'a', 'b')='B')  

But it look's like he only count all the items, so he gives me the answer 3. Can you help me?

Labels (1)
1 Reply
Or
MVP
MVP

It looks like you might want to create a table or graph with modulo being the dimension and count(item) being the measure?

If this needs to be done script-side instead, perhaps:

Load modulo, count(item) as myCount

From YourTable

Group by modulo;