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
allora
Frequent Visitor

Changing legend based on how I filter my line graph

Hello! I have a line graph that shows sales and can be filtered by Country, State, and City. I have created one filter than can filter first by Country, then by State, and then by City.

 

image 1:

allora_2-1675205650499.png

 

 

My line graph has the following filters:

 

image 2:

allora_0-1675205637493.png

 

 

These are the filters being used on the slicer for my line graph:

 

image 3:

allora_1-1675205637442.png

 

 

The way it works now is, if i select a countries or multiple countries, I can see the sales for multiple countries at a time and it will show the results on different lines. This works as it should (see first image).

Now, let us say I click the drop down on Canada and select Quebec and Ontario, the graph combines the sales for the 2 states/provinces and shows them one line (see image 4). How can I get Quebec and Ontario on separate lines and have the legend reflect Quebec and Ontario instead of it showing Canada still?

 

Image 4:

allora_3-1675205760373.png

 



Essentially, when I select just countries I would like the legend to show the countries, when I select states, I want to see the states, and when I select the cities I want the legend to show the cities.

 

The other thing that is happening is, lets say I select AZ from USA and Quebec from Canada. The graph will show me the results for these two states/provinces but the legend will continue to say USA and Canada instead of AZ and Quebec (see image 5).

 

image 5: 

allora_4-1675205910140.png

 

Any tips would be appreciated!

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @allora ,

 

you can achieve what you are looking for by using the Field parameters feature: Let report readers use field parameters to change visuals (preview) - Power BI | Microsoft Learn

But at the current moment, it is a bit tricky to "simulate" the hierarchy. Maybe you can adapt the solution posted by @otravers here: Field Parameter - Hierarchy - Microsoft Power BI Community

 

Hopefully, this provides an idea of how to tackle your challenge.

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

1 REPLY 1
TomMartens
Super User
Super User

Hey @allora ,

 

you can achieve what you are looking for by using the Field parameters feature: Let report readers use field parameters to change visuals (preview) - Power BI | Microsoft Learn

But at the current moment, it is a bit tricky to "simulate" the hierarchy. Maybe you can adapt the solution posted by @otravers here: Field Parameter - Hierarchy - Microsoft Power BI Community

 

Hopefully, this provides an idea of how to tackle your challenge.

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.