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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
dreyz64
Helper III
Helper III

Dynamic Legend on a stacked column chart

Hello everyone,

 

I am trying to create a stacked column chart with a legend that can be changed via a slicer.

In Tableau it is very easy to do: I create a calculated field where I say "CASE parameterLegend when "SHOP", [Shop]

when "Market", [Market], etc..

Basically I tell my calculated field to take the values of the column shop if my parameter for my legend is equal to shop and so on.

I wanted to do the same thing in PBI: create a custom column where the values inside would take the values of the column i want to use as a legend.

However i cannot find a way to do this...
I have tried to illustrate what I want to do in the image below.
Thanks a lot for the help!

 

2020-05-04_18-51-06.jpg

 

5 REPLIES 5
parry2k
Super User
Super User

@dreyz64 you are looking dynamic x-axis, check this video, hope it helps.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  I am looking at a dynamic Legend (the colors), not the X axis which is fixed (or Y axis for that matter).

@dreyz64 no idea what you mean?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k I have a stacked column chart.

In the stack column chart you can add a column to the 'Legend' section.

This will separate each bar in colors according to the values of the column put in legend.

Like so:

2020-05-06_10-04-10.jpgWhat I want to do now is that the field i put in the "legend' section to change based on a slicer selection.

 

aalev
Frequent Visitor

Hi dreyz64, I have the same requirement, did you sort it out ?

I reformulate here:

How to dynamically change the way stack chart is stacked according to a slicer selection ?

 

I want to change the stacking dimension (called "Legend" in tack column visualization) according to a slicer selection. For instance: stack a sales fact table, "by state" or "by product category" or "by client type"...according to a slicer selection !

 

Thanks for your help!

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.