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
Anonymous
Not applicable

Filter by clicking on chart legend

Hi, I have a chart as follow:

ss.png

The data is loaded from 4 columns in a table: Date, Additional Cost, Trip Rate, and kg. I created a measure for each of the cost.

 

What I'm trying to do is create a cost card that change when clicking on the legend (Total cost when none is selected, or only additional cost/trip rate).

 

Your help would be greatly appreciated.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi  @Anonymous ,

 

You cannot do this directly you need to do a workaround:

  • Create a table with the following information:
Measure
Total Cost
Trip Rate

 

Now do the following measure:

Selection Measure = SWITCH(SELECTEDVALUE('Legend_Table'[Measure]);"Trip Rate";[Trip rate measure];"Total Cost";[Total cost measure];[Total cost measure])

 

Now create your chart in the following way:

  • Shared Axis Date
  • Column Series: Measure column (previous create column)
  • Columns Values: Selection Measure
  • Line Values: Kgs Measure

For your card you just need to add the Selection Measure and everything will work accordingly.

 

Check a PBIX file, altough the axis is a category works the same for dates.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi  @Anonymous ,

 

You cannot do this directly you need to do a workaround:

  • Create a table with the following information:
Measure
Total Cost
Trip Rate

 

Now do the following measure:

Selection Measure = SWITCH(SELECTEDVALUE('Legend_Table'[Measure]);"Trip Rate";[Trip rate measure];"Total Cost";[Total cost measure];[Total cost measure])

 

Now create your chart in the following way:

  • Shared Axis Date
  • Column Series: Measure column (previous create column)
  • Columns Values: Selection Measure
  • Line Values: Kgs Measure

For your card you just need to add the Selection Measure and everything will work accordingly.

 

Check a PBIX file, altough the axis is a category works the same for dates.

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Yes, worked like a charm 🤩 Thanks a lot for your effort @MFelix!

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.