Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do you perform a Count IF statement over various fields

Hi, hoping someone can help me with working Count If statements

I have been trying to produce a count if expression in a table based on how i know it does work in excel and can not get the answer i need.

Sample data with correct answer in excel :-

client1client2accountaaccountbaccountc=Countif(clienta:clientc,">0")
abc1230132
abc2340000
123cde5973
cde5680201

I am just trying to count each field that has a value in. Regardless of what the value is in the cell it would give that cell a count of 1 then in the new field the count of 1's would be added up so in the above example i have 3 fields i am counting so my new field would never have a count greater than 3

In Qlik i have tried variations of the following

count(if(accounta='>0' or accountb='>0' or accountc='>0',1))

Ideally id like to put this in the load script so that i can produce a new field with the count in but even if i can just put it in an expresssion at the end of my table that would work

thanks

1 Solution

Accepted Solutions
sunny_talwar

My bad, try this

Sum(RangeMin(accounta, 1) + RangeMin(accountb, 1) + RangeMin(accountc, 1))

Capture.PNG

View solution in original post

6 Replies
sunny_talwar

May be try this

Sum(RangeMin(accounta, 1), RangeMin(accountb, 1), RangeMin(accountc, 1))

Anonymous
Not applicable
Author

thanks for relying but that does not appear to work in my table expression. Or would this work in the script load?

sunny_talwar

My bad, try this

Sum(RangeMin(accounta, 1) + RangeMin(accountb, 1) + RangeMin(accountc, 1))

Capture.PNG

Anonymous
Not applicable
Author

thank you soooooo much ive spent days trying to work this out! do you know if i can add it in to the script as a new field?

sunny_talwar

Sure, this should work in the script also...

RangeMin(accounta, 1) + RangeMin(accountb, 1) + RangeMin(accountc, 1) as NewField

Anonymous
Not applicable
Author

thank you so much your help really appreciate it