Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filter Data based on Color

Hi,

 

Is there a way to filter the data on the basis of the color ? I have a data table where i have done conditional formatting to show Red,Green,Yellow. I want to know if there is a way to add a slicer where i can filter on the data which is red,green etc.

Thank you for all the help in advance.

6 REPLIES 6
dax
Community Support
Community Support

Hi saknivi

You also could create a calculated column to achieve this goal

Column =
IF (
    colorslicer[amount] >= 0
        && colorslicer[amount] < 7,
    "Red",
    IF (
        colorslicer[amount] >= 7
            && colorslicer[amount] < 12,
        "Blue",
        IF ( colorslicer[amount] >= 12, "Yellow", "White" )
    )
)

45.png46.png

Best Regards,

Zoe Zhi

 

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

Anonymous
Not applicable

 
Anonymous
Not applicable

So here's the issue i have :

The value in my rule always keeps changing and the basis of the value i have added color coding in my data, thus i am not sure how to go about this now?

PBI.PNG

dax
Community Support
Community Support

Hi saknivi,

Did you mean that after you set conditional color, you want to data automatically changed by slicer without writing measure or calculate column for slicer, right? If so, I think your requirement can't be achieved currently, you need to write corresponding measure or calculated column for slicer which match conditional formatting.

 

Best Regards,
Zoe Zhi

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

dax
Community Support
Community Support

Hi saknivi,

In your scenario, if you want to filter data based on color, you could try below steps:

1.Create a color table(used for slicer)

42.png

2.Then you could try to use below measure

Measure 4 =
VAR temp =
    IF (
        MIN ( colorslicer[amount] ) >= 0
            && MIN ( colorslicer[amount] ) < 7,
        "Red",
        IF (
            MIN ( colorslicer[amount] ) >= 7
                && MIN ( colorslicer[amount] ) < 12,
            "Blue",
            IF ( MIN ( colorslicer[amount] ) >= 12, "Yellow", "White" )
        )
    )
RETURN
    IF (
        temp IN VALUES ( color[Column1] ),
        CALCULATE ( SUM ( colorslicer[amount] ) ),
        BLANK ()
    )

3.Then you could set measure like below in Filters, and set conditional format for measure

43.png44.png

Best Regards,

Zoe Zhi

 

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

dax
Community Support
Community Support

Hi saknivi,

In your scenario, if you want to filter data based on color, you could try below steps:

 

1.Create a color table(used for slicer)

42.png

2.Then you could try to use below measure

Measure 4 =
VAR temp =
    IF (
        MIN ( colorslicer[amount] ) >= 0
            && MIN ( colorslicer[amount] ) < 7,
        "Red",
        IF (
            MIN ( colorslicer[amount] ) >= 7
                && MIN ( colorslicer[amount] ) < 12,
            "Blue",
            IF ( MIN ( colorslicer[amount] ) >= 12, "Yellow", "White" )
        )
    )
RETURN
    IF (
        temp IN VALUES ( color[Column1] ),
        CALCULATE ( SUM ( colorslicer[amount] ) ),
        BLANK ()
    )


3.Then you could set measure like below in Filters, and set conditional format for measure43.png44.png

 

Or you also could try to create a calculate column which is same as condition format like below, then use this column in Slicer

 

Column =
IF (
    colorslicer[amount] >= 0
        && colorslicer[amount] < 7,
    "Red",
    IF (
        colorslicer[amount] >= 7
            && colorslicer[amount] < 12,
        "Blue",
        IF ( colorslicer[amount] >= 12, "Yellow", "White" )
    )
)

45.png46.png

Best Regards,
Zoe Zhi

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors