Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic expression based on filter - Qlik Sense

Hi Guys,

I have two dimensions

1. Product Category

2. Product Name

So the purpose is.. if user has only made selection on Product Category level instead of Product Names then the table should show count of total categories and as soon as user filters any product Name then that expression should change to count product names.

Something like this:

If Product Name Selection is > 0 then count(Distinct([Product Name])) else  Count(Distinct([Product Category]))

What is the best way to write that expression?

Thank you.

1 Solution

Accepted Solutions
sunny_talwar

May be like this

If(GetSelectedCount([Product Name]) > 0, Count(DISTINCT [Product Name]), Count(DISTINCT [Product Category]))

View solution in original post

2 Replies
sunny_talwar

May be like this

If(GetSelectedCount([Product Name]) > 0, Count(DISTINCT [Product Name]), Count(DISTINCT [Product Category]))

Not applicable
Author

Thanks Sunny