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
gary_connolly
Advocate II
Advocate II

Create a Switch to dynamically chance the AXIS or LEGEND of a chart

 

I have created a table which holds the demographic variables used in various stacked bar charts.:

 

Power BI Demos.PNG

 

I was wondering if there was any way I could then use the SWITCH function to select the AXIS or Legend source, like I would for the measure:

 

X Measure = SWITCH(ALLSELECTED('Chart Measures'[Measure 1]),"Age", SELECTCOLUMNS(TransportCharge,[PatientAge]),"Ethnicity",SELECTCOLUMNS(Ethnicity,[EthnicCategory]),"Months",SELECTCOLUMNS(TransportCharge,[Transportation Month]),"Deprivation",SELECTCOLUMNS('Census Data',[Deprivation Group]))

 

 

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @gary_connolly,

 

Here is a similar thread in which some solutions are mentioned there. Could you go to check if it helps in your scenario? Smiley Happy

 

Regards

GilbertQ
Super User
Super User

What happens when you use your "X Measure"?




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

Proud to be a Super User!







Power BI Blog

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