Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to syntax logical condition that ALL filters are selected

I have a filter pane with three filters: 'Belgium', 'Netherlands' and 'Luxembourg'.

Based on whether one, two or all of these countries are selected a different formula has to be applied to get a score. My syntax so far looks like this:

if(CountryName='Belgium', 5+3,

if(CountryName='Netherlands', 6+2,

if(Countryname='ALL', 9+1)))

Of course these formulas are not the real ones, but I use these for simplicity. The mistake is in the last line. How do I tell Qlik to apply the formula '9+1' when ALL filters are selected?

Many thanks for an answer!

1 Solution

Accepted Solutions
rubenmarin

Hi Pieter, there are several ways to check if all values are selected, some examples:

- If(Count(Dintinct CountryName)=Count({1} Distinct CountryName)

- If(GetSelectedCount(CountryName)=3 // In this case the fixed '3' can work, Benelux number of countries doesn't seem to change so often to have this in a dynamic way.

- If(GetPossibleCount(CountryName)=3 //Use this case you want that no selections is equal to select all values

- If(GetExcludedCount(CountryName)=0

Edit: to clarify: depending on datamodel, selections on other fields can affect the values returned for some functions

For no selections:

- If(GetSelectedCount(CountryName)=0

View solution in original post

3 Replies
Not applicable
Author

Oh and likewise: how do I tell Qlik to apply a certain formula of NO filter is selected?

Not applicable
Author

Hi,

I'm not sure if this is what you're looking for and whether you want to do this in script or front end.

But if you want to do If from expression, You can use GetFieldSelections(Country) to see which one selected, or GetSelectedCount(Country) to see if ALL or nothing selected

If not the case, can you please post sample data & the formula that you're trying to achieve.

rubenmarin

Hi Pieter, there are several ways to check if all values are selected, some examples:

- If(Count(Dintinct CountryName)=Count({1} Distinct CountryName)

- If(GetSelectedCount(CountryName)=3 // In this case the fixed '3' can work, Benelux number of countries doesn't seem to change so often to have this in a dynamic way.

- If(GetPossibleCount(CountryName)=3 //Use this case you want that no selections is equal to select all values

- If(GetExcludedCount(CountryName)=0

Edit: to clarify: depending on datamodel, selections on other fields can affect the values returned for some functions

For no selections:

- If(GetSelectedCount(CountryName)=0