3 Replies Latest reply: Jun 10, 2016 7:12 AM by Nhu Ngo

# 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!

• ###### Re: How to syntax logical condition that ALL filters are selected

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

• ###### Re: How to syntax logical condition that ALL filters are selected

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.

• ###### Re: How to syntax logical condition that ALL filters are selected

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