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
erchs
Frequent Visitor

Can you hide legend label when no data exist in a stacked bar

I have a stacked bar graph which displayes processes based on a filter. There are legend labels for all types of processes. However, for some filters, some processes will not show up. 

 

To illustrate, suppose I have 5 processes that I want to show on the stacked bar. So, there are 5 labels in the legend. Suppose, I have two types of patients. For type 1, only three processes are relevant.

 

Is there a way to show only those relevant labels when I select patient type 1? 

1 ACCEPTED SOLUTION

@erchs,

 

Click on the down-arrow in the field you want to change in the Visualizations pane, and deselect Show items with no data.

https://powerbi.microsoft.com/en-us/guided-learning/powerbi-learning-3-11c-display-empty-categories/

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.

View solution in original post

10 REPLIES 10
NotMyJob
Helper II
Helper II

This should not be marked as a solution.  In every graph I've checked this alleged option does not exist.

Greg_Deckler
Super User
Super User

Check out this technique on dynamic categories. Seems like it might be applicable to your requirement.

 

https://community.powerbi.com/t5/Desktop/Dynamic-Category-Using-a-Slicer/td-p/216971

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

This is somewhat in the line of what I was looking for but not quite. If there is a switch in the legend option that turns the labels off if no data, would be great.

@erchs,

 

Click on the down-arrow in the field you want to change in the Visualizations pane, and deselect Show items with no data.

https://powerbi.microsoft.com/en-us/guided-learning/powerbi-learning-3-11c-display-empty-categories/

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.

This sounds like a solution but for the stacked bar graph, this option doesn't show up. I do not see the option. Also, please note, the elements are Measures. I've tried with the raw data element, and it still does not have that option. 

@erchs,

 

You need to take advantage of the Legend field.

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.

These are calculated measures and cannot be added to the Legend pane. Could you point me to a resource that shows how I can utilize the legend field in this situation? Thanks.

@erchs,

 

To use Legend, at most one measure can be added to Value.

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.

I have more than one measure in the value field as I am dealing with stacked bar graph.

I am not aware of such a switch.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.