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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

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

@Lakshmi_Koduri , 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"} )) )

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Lakshmi_Koduri , 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"} )) )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors