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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PowersBI
Frequent Visitor

Legend - Too many Values -- How to hide legend items without data for specified date range?

Hi Power Bi Community:

 

I'm using a stacked column chart with a legend.  The legend field is a parameter, so in my case I can dynamically switch it between specific project or business unit. 

 

When I have the legend selected for specific project, I receive a message "Too Many Values.  Not displaying all data.  Filter the data or pick another field."

 

If I filter to a more recent date where I would only expect to see a few projects with data, all the projects still show up in the legend.  I had stumbled on this potential solution here -- to hide legend items if there is no data, but I can't seem to get this working in either the pie chart or stacked column chart.  Is anyone aware of a solution for this issue? 

 

When I select the legend parameter field from the visual, "Show Items with no data" is already deselected.

 

The only relevant documentation I could find online was here, but I was not sure how to interpret it. 

 

https://learn.microsoft.com/en-us/power-bi/paginated-reports/report-design/visualizations/chart-lege...

 

"The legend is always connected to a series. If a legend item appears in the legend but the corresponding series is not displayed in the chart, the most likely cause is that the series does not contain any values. You must remove this series in order to remove the legend item from the legend. To remove a series from your chart, you can right-click the specified series and select the Delete Series option." 

 

Thanks in advance

 

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @PowersBI ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1705456177190.png

 

You can change the condition to 0 or blank, depending on your actual needs

Measure = IF(MAX('Table'[Value])<>0,1,0)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
PowersBI
Frequent Visitor

Thanks for providing the .pbix file.  This solution definitely works in the example you provided.  I modified your table with some extra values and dates.  Even when I remove your measure, the legend is dynamically changing and hiding items based on the date filter. 

 

I still haven't gotten it to work in my model, but you've shown me it's possible!  Thank you. 

v-tianyich-msft
Community Support
Community Support

Hi @PowersBI ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1705456177190.png

 

You can change the condition to 0 or blank, depending on your actual needs

Measure = IF(MAX('Table'[Value])<>0,1,0)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.