Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
WorkFish
Contributor II
Contributor II

how to write two conditions in count() function

hi guys

    I have a expression like this: count({<FieldA={"valueA"} >}distinct FieldB) and it works,
now i want to add another condition on it but i dont know how to write the expression.

Here's my new expression and it's wrong:count({<FieldA={"valueA"} and FieldB={"Yes"}>}distinct FieldB).

Can anyone tell me how to modify it?
Thanks in advance .

Labels (2)
5 Replies
Or
MVP
MVP

count({<FieldA={"valueA"} , FieldB={"Yes"}>}distinct FieldB)

Note that this expression is only ever going to return either 0 or 1, since only "Yes" values will be possible in FieldB.

WorkFish
Contributor II
Contributor II
Author

hi @Or 

it's works. but if i want add a condition which is : FieldB is null or len(FieldB)=0 ,how should i write

 

Or
MVP
MVP

If FieldB is null, Count(FieldB) will be 0, so there's no need to do anything different as the outcome will be identical.

WorkFish
Contributor II
Contributor II
Author

Sorry that i made a mistake.

It's count({<FieldA={"valueA"} , FieldB={"Yes"}>}distinct FieldC),the third Field  is C not B.

So the "FieldB is null " how to write it ?

Feel Sorry again