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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic Legend when select slicer

Hello everyone,

Currently, I have a dashboard to count to the number of each rate appears in a year like scr below

ngocpt00_0-1666095301844.png

 


 Updating Media

What I want is that when I select year 2022 or (both year 2022 and 2021), the legend name with appear like this

ngocpt00_2-1666095114969.png

A --> Good

B --> Average

C --> Bad

 

But when I select only 2021, it still keeps as it is (A,B,C). 

Please advise me on this.

Thank you so much

 

My data:

 

year     rate

2022A
2022B
2021A
2021A
2021B
2021C
2022B
2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

You can create calculated column  like below and add it to the legend of visual.

legend_ =
IF (
    test[ rate] = "A",
    "Good",
    IF ( test[ rate] = "B", "Average", IF ( test[ rate] = "C", "Bad" ) )
)

vhenrykmstf_0-1666174207466.png

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry


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

Anonymous
Not applicable

Hi @v-henryk-mstf 

Thank you for your reply.

But what I want is when 2022 is selected (select alone or select both 2021 and 2022) the legend is (Good, Average, Bad),

When it is not selected, the legend is A,B,C

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors