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

COUNT DISTINCT right after having set multiple conditions into an IF statement (graph expression)

I need to count distinct occurrences into a dataset which meet three conditions.

Until now I've tried with something like follows:

 

=COUNT(DISTINCT(IF(condition_1 = True AND condition_2 = True AND condition_3 = True, row)))

 

While it worked perfectly using just two conditions, it is when I add the third one that, even if the expression editor doesn't show any warning message, the output I get is entirely wrong when I check it on my data warehouse.

 

How should I tweak the expression so it gives me a correct output?

Labels (2)
2 Replies
sasikanth
Master
Master

Try below one, please share your original expression if the below one doesn`t work

COUNT(DISTINCT

               IF(

                    (condition_1 = True AND condition_2 = True )

                            AND

                   (condition_3 = True)

            , row)

   )

 

Thanks, 

Sasi

Or
MVP
MVP

You'll have to be more specific about the data structure and conditions. There's no limit on the number of conditions, so I'm guessing the third condition is problematic in itself, rather than the expression in general.