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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.