Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)

I am currently writing a formula in a filter MyFilter's condition (shown below). I am trying to make it so that it will use the MyParameter's value as a filter if MyParameter's value is not All. In the case that it is All, then I would like it to not filter anything. I.e., Display all values. Here is what I have so far, which is incorrect. How might I be able to achieve the desired outcome? Thank you in advance for any help that you may offer.

IIF([MyParameter] != "All", // TEST CONDITION

[MyFilter] = [MyParameter], // THEN BLOCK

[MyFilter] = "ALL") // ELSE BLOCK

1 Answer

0 votes
by (47.2k points)

As you don't want the filter to filter anything in the case where your parameter is set to 'All'.

  • There are 3 pieces to this:

  1. [MyParameter]- Your parameter that includes values and 'All'

  2. [FilterField] - The field you want to use to filter against the parameter value

  3. [FilterCalc] - A calculated field to use in the filter card

  • The [FilterCalc] would have this logic:

[MyParameter] = 'All' OR [MyParameter] = [FilterField]

  • And just make sure you set [FilterCalc] 'True' once in the filter card.

  • Note that this is almost no different than putting the [FilterField] directly in the filter card. The only difference is that you explicitly restrict the values in your parameter ([MyParameter]).

Browse Categories