Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Show active filters.

Hello.

 

I have a very extensive report with a lot of slicers.

 

What I need is something that shows me the filters applied (or slicers) at the moment. It dynamically should change when a slicer is (des)selected.

 

Since Power BI does not offer this feature, I need a workaround.

 

What I achieved:

In another smaller report, I created one measure for each column that returns a text if the column ISFILTERED:

  

M_checkfilter = IF(ISFILTERED(Table[Column]);"Filter is Active";"")

This measure is used within a text box card visual and situated above a slicer that filters the previous column referenced. Then, when the slicer is actived, the text appears (color: red, font size: medium-high) so the user can easily show what filters are actived.

 

Well, it works, but in an extensive report it comes unmanageable creating one measure and text box for each column. I'm looking for something more centralized.

 

I hope you can come up with something.

 

Thank you.

 

----

Javi

  • Anonymous's avatar
    Anonymous
    8 years ago

    Ok... I achieved a solution... it is not very orthodox but it works fine... Very tedious to write...

     

    It consists in a Measure of more than 120 lines (because the big number of columns and tables) with a text result that I can insert into a Card visualization or a table for better viewing.

     

    The approximate formula syntax of the measure is like this:

     

    _Active filters_ = 
    "FilterSubsection:"
    &IF(ISFILTERED(Table1[Column1]);
        UNICHAR(10)&"- StringColumnName: "& CONCATENATEX(VALUES(Table1[Column1]);Table1[Column1];", "))
    &IF(ISFILTERED(Table1[Column2])
    ... (etc)

    Where u see Table1 you can refer to Table2, Table3 an so on.

    UNICHAR(10) is a newline character and & simbol is to concatenate strings.

     

    Hope this serves to someone in the future and really hope that the PBI team include a feature to achieve this easier.

     

    Thanks.

14 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Ok... I achieved a solution... it is not very orthodox but it works fine... Very tedious to write...

     

    It consists in a Measure of more than 120 lines (because the big number of columns and tables) with a text result that I can insert into a Card visualization or a table for better viewing.

     

    The approximate formula syntax of the measure is like this:

     

    _Active filters_ = 
    "FilterSubsection:"
    &IF(ISFILTERED(Table1[Column1]);
        UNICHAR(10)&"- StringColumnName: "& CONCATENATEX(VALUES(Table1[Column1]);Table1[Column1];", "))
    &IF(ISFILTERED(Table1[Column2])
    ... (etc)

    Where u see Table1 you can refer to Table2, Table3 an so on.

    UNICHAR(10) is a newline character and & simbol is to concatenate strings.

     

    Hope this serves to someone in the future and really hope that the PBI team include a feature to achieve this easier.

     

    Thanks.

    • Anonymous's avatar
      Anonymous
      Not applicable

      First of all, thanks for the amazing post, it was really usefull for me.  

       

      Although it works perfectly when i applied the sintax: 

      Filter activ =
      "Filter active:"
      &IF(ISFILTERED(event[Sex])
      ;UNICHAR(10)&"Sex: "& CONCATENATEX(VALUES(event[Sex]);event[Sex];", "))
      &IF(ISFILTERED(event[age])
      ;UNICHAR(10)&"Ages: "& CONCATENATEX(VALUES(event[age]);event[age];", "))
      &IF(ISFILTERED(eventoysujeto[Date])
      ;UNICHAR(10)&"Date: "& CONCATENATEX(VALUES(event[Date]);eventoysujeto[Date];", "))

       

      It shows me something (perfect) like:

       

      Filter active:

      Sex: Male.

      Age: 85, 88, 73, 55, 80, 73, 89, 72, [...] and so on.

      Date: 4/3/2017, 2/21/2018  [...] and so on.

       

      My problem is that i do have dozens of different ages and dates.  I do want to obtain something like this:

      Filter active:

      Sex: Male.

      Age min: 56

      Age max: 90

      fDate: 4/3/2017

      lDate: 12/31/2017

       

      Or if possible: 

      Filter active:

      Sex: Male.

      Age: 56 to 90.

      Date: 4/3/2017 to 12/31/2017.

       

      May someone help me?

       

      Thanks a lot,

      Angel

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous For that, you can do something like this:

         

        [...]
        &IF(ISFILTERED(event[age])
        ;UNICHAR(10)&"Ages: "& MIN(event[age]) & " - " & MAX(event[age]);", "))
        [...]

        Tell me if this is what you are looking for.

         

        Regards.

         

         

    • Bruno_Cippitell's avatar
      Bruno_Cippitell
      Regular Visitor

      Thank you very much for sharing.

      It works perfect and I have to say: it is not that tedious and simply to achieve.

      Two days ago a customer asked me to have "Active filter" text solution on a report and this solution fits perfectly. Thaks you one more time.

    • Bruno_Cippitell's avatar
      Bruno_Cippitell
      Regular Visitor

      Thak you very much for sharing. It works perfect and I have to say: it is not that tedious and simply to achieve.

      Two days ago a customer ask to have "Active filter" text solution and this solution fits perfectly. Thaks one more time.

  • I know it's an old topic, but just wanted to share an awesome video that shown how you can generate the filtersContext measure just in 2 clicks in DAX Studio:

    https://www.youtube.com/watch?v=kccmckYOmbw&ab_channel=SQLBI

     

    In my case, it generated a 1600 line measure 🙂

     

    Then just drop it onto a Table visual and you will see a list of applied filters on specific table or even all of the tables.

     

    Super helpful when you are trying to debug some DAX measure or if you just want to show to end user all the filters applied in a tooltip.

    • kazet_vo's avatar
      kazet_vo
      Regular Visitor

      This is really a great hint! Thank you!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-huizhn-msft

       

      I'm sorry. I meant Card visual instead text box.