Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Filtering a definition by using if or where clause?

Hello everyone,

i have a table and in its function i add a "Count" function.

COUNT(DISTINCT keyattribute)

This works. So in the end i get a table with values on the left side and frequencies on the right side.

Now i want to filter this table in a way that a "WHERE" Clause is predefines.

This wont work for me.(example how it did not work)

COUNT(DISTINCT keyattribute) WHERE filterattribute='sn'

Now i also tried doing it with a if CLAUSE:

if(filterattribute='sn', COUNT(DISTINCT keyattribute)

At least this variant was syntactically correct, but it does not show the results i want it to. Output is just an empty table (i mean no frequencies.)

Can anyone help me here?

1 Solution

Accepted Solutions
sunny_talwar

How about using set analysis:

Count(DISTINCT {<filterattribute = {'sn'}>} keyattribute)

View solution in original post

3 Replies
sunny_talwar

How about using set analysis:

Count(DISTINCT {<filterattribute = {'sn'}>} keyattribute)

arulsettu
Master III
Master III

i think you missing closing bracket

try this

if(filterattribute='sn', COUNT(DISTINCT keyattribute))


or


count({<filterattribute{'sn'}>}keyattribute)

Not applicable
Author

Thanks a lot :-). This worked!