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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ClausS
Helper I
Helper I

I need to create a Dynamic Legend in a Pie Chart based on Slicer Selection

Hi,

I have a Slicer to select a Sales Territory, values are US or EMEA. I have a Pie chart which should show the sales grouped by (using the Legend Field) either Address_Countries, when EMEA is selected or Address_States if US is selected.

Is there any way to use different Table fields in the Pie chart Legend field based on a slicer selection? I don't want to work with Bookmarks.


Some additional Explanation: The Teeritory Slicer is important to slice the data set for the Page, and I'm looking for an elegant solution by NOT introducing a 2nd slicer based on Parameters because when you select US , having a chart slicing you sales by country makes no sense so I automaticly want to show it by State.
Thanks

1 ACCEPTED SOLUTION
Sergii24
Super User
Super User

Hi @ClausS, I see that you don't want to use a field parameter or bookmark but still want to change values in the legend of a pie chart.

 

Let's take a look at this example:

Sergii24_0-1737901185780.png

As you can see, legend values on the visual depend on a column that is used in "Legend" section when bulding pie chart. This section (i.e. Legend) allows you to select one or multiple columns and even create a hirarchy for you. However, the hierarchy can't be defined dynamically neither a single column can be replaced with another one. Both operations should be done by the report author.

Field parameter works in a specifi manner that allows to "switch" between columns. I'd say that this is "the most elegant" way to achieve the desired result. "Bookmark" can be an alternative, but I won't explain it as you prefer to not use it.

If you really want to avoid both, then you need to work on a data model side: once you select a desired value in a slicer, it should filter another table which contains 2 columns: "slicer value" and "desired legend output". Now you use "desired legend output" as a legend field. However, the outcome of such approach would really depend on your data model (once you do it, something else can broke or not work as expected). I'd definitely reccomend you to avoid any similar complexity when the option with "field parameter" is available.

If you come up with a better solution, let us know so we all can learn! 🙂

View solution in original post

8 REPLIES 8
Sergii24
Super User
Super User

Hi @ClausS, I see that you don't want to use a field parameter or bookmark but still want to change values in the legend of a pie chart.

 

Let's take a look at this example:

Sergii24_0-1737901185780.png

As you can see, legend values on the visual depend on a column that is used in "Legend" section when bulding pie chart. This section (i.e. Legend) allows you to select one or multiple columns and even create a hirarchy for you. However, the hierarchy can't be defined dynamically neither a single column can be replaced with another one. Both operations should be done by the report author.

Field parameter works in a specifi manner that allows to "switch" between columns. I'd say that this is "the most elegant" way to achieve the desired result. "Bookmark" can be an alternative, but I won't explain it as you prefer to not use it.

If you really want to avoid both, then you need to work on a data model side: once you select a desired value in a slicer, it should filter another table which contains 2 columns: "slicer value" and "desired legend output". Now you use "desired legend output" as a legend field. However, the outcome of such approach would really depend on your data model (once you do it, something else can broke or not work as expected). I'd definitely reccomend you to avoid any similar complexity when the option with "field parameter" is available.

If you come up with a better solution, let us know so we all can learn! 🙂

Hi Sergii,

 

thanks for taking the time to explain the possible solutions in detail. I realized that I need to follow the suggest data model path to make that fully automated since that is what I want. 

Have a nice day

danextian
Super User
Super User

They've said it. Use field paramters. You wil need to rename each field thgouh to EMEA for Address_Countries field and US for Address_States.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

That's not what I want. I don't want a 2nd slicer, I want the legend to switch dynamicly based on the Territory selection. The Parameter Solution is NOT solving the challange I have. I can't just rename the slicer to EMEA because I need the Territory slicer as well for the page.

nilendraFabric
Super User
Super User

Hello @ClausS 

 

@Fowmy pointed to right direction 

 

1. Create a field parameter with `Address_Countries` and `Address_States`.
2. Add the generated slicer to your report.
3. Drag the field parameter into the pie chart’s Legend.
4. The slicer will dynamically update the legend based on selection.

 

hope this helps.

 

That's not what I want. I don't want a 2nd slicer, I want the legend to switch dynamicly based on the Territory selection. The Parameter Solution is NOT solving the challange I have.

Fowmy
Super User
Super User

@ClausS 

Try Field Paramters 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

That's not what I want. I don't want a 2nd slicer, I want the Legend to switch dynamicly based on the Territory selection. The Parameter Solution is NOT solving the challange I have.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors