Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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

 


 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

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

  • v-henryk-mstf's avatar
    v-henryk-mstf
    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" ) )
    )

     

    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's avatar
      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