Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Filter based off conditional format colours

Is it possible to filter by colour / add a slicer to filter by colour on table that has conditional formatting on?

i.e. I have a row of reds and greens based off of positive and negative figures - is there an option similar to excel where you can filter by colour?

 

Example

 

Data
0.15
1.2
-0.33
-1.6
2.1

 

I want to be able to select the column (similar to sort) or select a slicer option that would then allow me to choose between showing only reds and greens

e.g. Select only Green = 

Data
0.15
1.2
2.1

 

I've searched and watched some videos but can't see this has been discussed, but feel like it would be an option somewhere?

Many thanks!

EDIT: I have two colours - Red and Green. Anything below 0 is Green and anything above 0 is Red.  
This column is based off a measure which calculates the difference between 2 other measures.
Would this impact any calcs?
I've created a colour table as suggested in one of the posts but can't get it to run off the measures.

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, I have had a look at this but doesnt seem to work even when trying to adapt.

      I simply have two colours - red and green. Anything below 0 is Green and anything above 0 is Red.

      This column is based off a measure which calculates the difference between 2 other measures.

      Would this impact the calc?

      I've created the colour table but can't get it to run off the measures?

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi , Anonymous 

    Please follow these steps: 

    1.create a measure and apply it to "font color conditional formatting。

     

    color formatting = IF(SELECTEDVALUE('Table'[Data])<0,"green","red")

     

     

     

    2.create another calculated table as below:

     

    Slicer table = DATATABLE("Value",STRING,{{"All"},{"red"},{"green"}})

     

    3. create a table control visual as below ,then apply it to visual filter pane

     

    Visual control = 
    SWITCH (
        SELECTEDVALUE ( 'Slicer table'[Value] ),
        "green", IF ( SELECTEDVALUE ( 'Table'[Data] ) < 0, 1, 0 ),
        "red", IF ( SELECTEDVALUE ( 'Table'[Data] ) > 0, 1, 0 ),
        1
    )

     

    For more details,please check attached  pbix file.

     

    Best regards,

    Eason