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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Power BI total labels not working when only one option in stacked bar chart

When total labels are turned on, the labels do not show when data is sliced to an option that has only one legend category. 

 

See here, the data is sliced and there are multiple legend values. The total labels work.

rbrocks_0-1655731453368.png

 

Here in the same chart, the data is sliced and there is only one legend value. The total labels disappear. 

rbrocks_1-1655731523124.png

We don't want to enable regular data labels, only the total. Is this intended functionality? Or is this a bug? Seems like if I choose total labels on they should always work by default.

 

Status: Needs Info
Comments
Sangor
Regular Visitor
Problem still not fixed....
endo
Regular Visitor
This is very buggy. Needs fixed.
oconnelln
New Member
I've found a solution: This assumes that you are using a column for your legend. I want a label to show the percent of each column that the legend category makes up and a total number at the top when multiple legend categories are visible, and just the total when the legend only has one category. You create three parameters, one for the percent of the total column each legend section takes up (you could also just do raw count): Pct Based on Legend Column = var _total = CALCULATE( DISTINCTCOUNT ('Base'[id] ) ,ALLSELECTED('Base'[LegendColumn]) ) RETURN FORMAT(DIVIDE( DISTINCTCOUNT('Base'[id] ) , _total ), "0%") One which counts the number of IDs: IDCount = DISTINCTCOUNT('Base'[ID]) And one which is a dynamic label that shows the percent when multiple categories are selected and the total count when only one category is selected. Use this as your label and turn on the total labels. labels_legendcolumn = VAR numcats = CALCULATE( DISTINCTCOUNT('Base'[LegendColumn]), ALLSELECTED('Base'[LegendColumn])) RETURN IF(numcats= 1, FORMAT([IDCount], "#,###"), [Pct Based on Legend Column] )
Pilares
Helper I
The "Total label" still does not appear when results are (cross-)filtered down to a single instance in the column legend. Please fix @Microsoft