Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter group

Hi all,

 

I have one I am struggling to even explain so I hope this little diagram might help. 

There is data that I want to be able to filter with a slicer but some of it is in more than one filter type, I cannot think of a way to do this, any ideas?

 

Made up data:
Column1 - Column2
134324 - Type 1
324234 - Type 1
545345 - Type 3
435345 - Type 2
353454 - Type 3
435344 - Type 3
453453 - Type 2
345324 - Type 1

 

The the "filters" or slicer
Filter 1 = Show only Type 1
Filter 2 = Show both Type 2 AND Type 3
Filter 3 = Show only Type 3

 

It is this second Filter 2 where I am struggling with.

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    You can create a new table to put the slicer.

     

    Then create a measure.

    New Column = 
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Slicer] ),
        "Filter 1 = Show only Type 1", CALCULATE ( SUM ( 'Table'[Column1] ), FILTER ( 'Table', [Column2] = "Type 1" ) ),
        "Filter 2 = Show both Type 2 AND Type 3",
            CALCULATE (
                SUM ( 'Table'[Column1] ),
                FILTER ( 'Table', [Column2] = "Type 2" || [Column2] = "Type 3" )
            ),
        "Filter 3 = Show only Type 3", CALCULATE ( SUM ( 'Table'[Column1] ), FILTER ( 'Table', [Column2] = "Type 3" ) )
    )

     

    The result is as follows.

     

     

    You can check more details from here.

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    You can create a new table to put the slicer.

     

    Then create a measure.

    New Column = 
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Slicer] ),
        "Filter 1 = Show only Type 1", CALCULATE ( SUM ( 'Table'[Column1] ), FILTER ( 'Table', [Column2] = "Type 1" ) ),
        "Filter 2 = Show both Type 2 AND Type 3",
            CALCULATE (
                SUM ( 'Table'[Column1] ),
                FILTER ( 'Table', [Column2] = "Type 2" || [Column2] = "Type 3" )
            ),
        "Filter 3 = Show only Type 3", CALCULATE ( SUM ( 'Table'[Column1] ), FILTER ( 'Table', [Column2] = "Type 3" ) )
    )

     

    The result is as follows.

     

     

    You can check more details from here.

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      That is perfect! Thank you very much 🙂

       

      I am sorry for the very long delay in marking as the solution, I got side tracked.

       

      Thanks again, this is very much appreciated.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Any ideas? I am still no closer to an idea how this would work.

  • Anonymous not sure what you mean show type 2 and type3? do you want these options to show in the slicer/filter? What you are trying to do?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Yes it is a bit tricky to explain 😞

       

      I need the slice to be able to like show an OR condition I guess. Show if the match is one OR another. 

      Is this possible?

       

      If an option is selected then filter for type 1 or type 2.