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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Dynamically control legend on a chart

Hi!

 

I have over 45 items on my legend on a clustered bar chart, and all of them show up when the chart if displayed. Wehn I use a Year/Month filter to filter down the rcords , is it possible to show the legends for only those items that appear on the bar, right now it shows up  all the lengends and that too not full information .

9 REPLIES 9
AllisonKennedy
Super User
Super User

I'm not sure what you mean, are you please able to provide more details and maybe photos? 

 

The legend should dynamically update with the chart unless you have asked it not to. 

 

Are you using a Year Filter or a Year Drilldown?

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

I am using a clustered chart which displays number of items, by Year/month and category of item. The Category of items are around 45  categories and that is the legend. In the legend it shows which color code the item is , since there re more than 45 categories , it does not fit all in one screen , so what I want to do is , when I use my Year/month filter on the report not drill down, basically it should remove all the categories that does not fall in that month /year , so only the legends corresponding displays on the report.

 

How many categories fall in a given month? I'm still unclear why it's not working. Are you able to share a sample file via OneDrive link please?

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Capture234.PNG

 

I was talking about the legend at the bottom of the screen, which shows all of them even when I use my Year/month filter, I want it to show only the ones that fall within that range.

So for example if you narrow down to 2021 October, what does it look like?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

The legend at the bottom still displays all the items .

Sorry @Anonymous  but we'll need a lot more information to help you out in this case, as this is not standard behaviour.

 

If the total graph has been filtered, the legend should filter also as per my screenshot here. You can see the chart on top with no filter, and the chart below with filter. Legend has automatically updated. 

 

Dynamic Legend.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Thanks Allison. I agree it should should filter out the legends as well and it does in my case as well when I use the Category filter, it does filter the lengends as well at the bottom , but when I filter by Year/month, that is when it stays the same.I get the entire list showing up on the legend.

 

Thanks

@Anonymous 

 

Right click Legend and deselect "Show items with no data". Besides, use measure below to deal with zero.

Measure 2 =
IF ( [Measure] = 0, BLANK (), [Measure] )

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors