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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jcl
Frequent Visitor

Legend (by field parameter) not getting filtered by visual filter

I have a bar chart where the y-axis and legend are attached to field parameters. The values on the x-axis are filtered by a 1/0 measure applied to the chart. The filter is working fine for the bars on the chart. However, the legend is not getting filtered like I would expect, even thought the filter is applied to the whole visual (including the legend). The problem is, the legend is trying to show all of the values of the field (around 225 unique companies in the source table), but Power BI limits the legend to 60 items, which causes the chart to be missing random data. My filter limits the number of companies to exactly 60, but isn't getting applied to the legend. Any ideas on how to apply this filter to the legend as well?

 

jcl_0-1707237783095.png

jcl_2-1707238675844.png

 

4 REPLIES 4
vanessafvg
Super User
Super User

it would probably be better then to build the filter into the measure you are using itself.  

 

Although I do have to say its quite difficult to read all that data with so many legends, even 60 is a lot.    is there a better way of doing this maybe?

 

what are you trying to demonstrate?

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Agreed, 60 is a lot. It's the big companies that show up on the chart that get highlighted vs. the smaller companies.

 

My filter is a simple measure that produces a 1 or 0 base on the value on the x-axis, like this:

 

 

_Mutual Filter = IF(SUM(Table1[Value]) > 100, 1, 0)

 

 

Table1 consists of:

  • Company ID
  • Value

A Company table looks like:

  • ID
  • Name
  • Is Parent

The filter seems to work fine for the chart, but not for the legend.

 

There is a one-to-many relationship between Company[ID] and Table1[Company ID].

 

If I put Company Name and _Mutual Filter in a table, I can see that all of the companies come in with a value of 1, which means that the filter isn't getting applied to the list of companies.

 

I'm trying to figure out how to change my measure to include filtering on the Company Name, but I'm not understanding the row vs. filter context. Is it possible?

jcl
Frequent Visitor

I pulled up a table in Power BI with Company ID, Company Name, Value, and _Mutual_Filter. Comparing the list of Company names in the table to the legend, I can see that the _Mutual_Filter does indeed filter the legend, but it's 78 companies rather than 60 that I thought I was calculating the "value" for the filter. So the chart is actually working correctly, and there's something in my calculation of value.

okey dokes, do you need anymore assistance?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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