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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

How to dynamically change one of the legend values in a chart based on the slicer selection.

Hello,

 

I have a chart visual with Sales values per Date and I have Product as legend (legend values are P1, P2, P3, P4). Now I have a slicer with two options Category A and Category B. My requirement is to show date-wise sales on the chart with Legends P1, P2, P3 when Category A is selected in the slicer and Legends P1, P4, P3 when Category B is selected in the slicer. Basically, I need to switch one of the legend values P2 with P4 through slicer. I tried in different ways but couldn't switch just one of the legend values dynamically based on the slicer selection. Could anyone please help me with this issue if you had encountered with such requirement?

 

THanks

Lakshmi

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , On option is bookmarks and button for category A and B and hide show.

 

Second: if category A and B are values of an independent slicer and (P1, P2 etc are already on legend and use a measure like

 

Use a measure like

If(selectedvalue(Category[Category]) ,

"A", calculate(Sum(Table[Value]), filter(Table, Table[Product] in {"P1", "P3", "P4"} )) ,

"B", calculate(Sum(Table[Value]), filter(Table, Table[Product] in {"P2", "P4"} )) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , On option is bookmarks and button for category A and B and hide show.

 

Second: if category A and B are values of an independent slicer and (P1, P2 etc are already on legend and use a measure like

 

Use a measure like

If(selectedvalue(Category[Category]) ,

"A", calculate(Sum(Table[Value]), filter(Table, Table[Product] in {"P1", "P3", "P4"} )) ,

"B", calculate(Sum(Table[Value]), filter(Table, Table[Product] in {"P2", "P4"} )) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Top Kudoed Authors