Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
divya_anand
Creator III
Creator III

count distinct based on 2 conditions

Hi,

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
stigchel
Partner - Master
Partner - Master

You can use set analysis like this

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

neelamsaroha157
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)