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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
erikoos
Frequent Visitor

Conditional Formatting Slicer?

Hi,

can anyone assist in creating a measure or calculated column I can use to make a conditional formatting dynamic legend slicer along with steps to use measure as a slicer? Or if there is another way to create a dynamic legend, please share. See attached.

I had to create a measure using a dax to calculate number of 'Yes' and 'No' so the percents in each row would highlight by correctly according to my range values.

 

Percent and color code values: Red '#FF0D0D' (0-85%) Yellow '#FFFB0D' (85-90%) Green '#12EA2B'(91-100%).

 

The conditional formatting rule is based on the percent of YES measure.  

visual example.jpg 

See DAX Measure below that was used to calculate percent of 'Yes' & 'No' in response column. Now I need to make a legend to reflect conditional formatting colors, preferably dynamic if possible. 

visual example.jpg

DAX Measure 

Percent of Respondent ID for Yes =
VAR _YESCount
=
CALCULATE(
    DISTINCTCOUNT('Sheet'[Respondent ID]),
    'Sheet'[Audit Elements Responses] IN { "Yes" }
)
VAR _PerYESCount
=
CALCULATE(
    _YESCount/
    DISTINCTCOUNT('Sheet'[Respondent ID])
)
RETURN
_PerYESCount

 

3 REPLIES 3
Anonymous
Not applicable

Hi @erikoos ,

Please try to create a measure with below dax formula:

Measure =
VAR _a = [Percent of Respondent ID for Yes]
VAR _result =
    SWITCH (
        TRUE (),
        _a < 0.85, "red",
        _a >= 0.85
            && _a <= 0.9, "yellow",
        _a >= 0.91
            && _a <= 1, "green"
    )
RETURN
    _result

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thank you for creating measure! How can I use this measure as a legend slicer for the conditional formatting colors? 

If you have a Pro license you can open a Pro ticket at https://admin.powerplatform.microsoft.com/newsupportticket/powerbi
Otherwise you can raise an issue at https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues .

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.