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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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