Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

count distinct based on 2 conditions


Could someone help me in writing the expression which should fetch the count of distinct values based on 2 conditions?

For example:

In the screenshot, there are 2 list boxes with 2 different expressions. How do I fetch the count of distinct values in both the list boxes combined?

That is, by seeing the list boxes I know 003, 005 appear in both list boxes, however I would like to have the count of distinct values from both the list boxes combined. (conditions).

So, according to the data in the screenshot, The value I want is "9" because I have 9 distinct values from both the list boxes combined.

Note: Working on the script side doesn't work for this case because the condition is triggered by selections in the layout.

I am attaching the qvw for reference.

Thank you.

2 Replies

You can use set analysis like this

=Count({<date1={">=1<=4"}>+<date1={">=5<=9"}>} DISTINCT codes1)

Specialist II
Specialist II

You can concat the two fields in your script and then count distinct of that field

Code1 & '|' & Date1 as NewField

Count(Distinct NewField)