Forum Discussion
Dynamic formatting not working with stacked bar chart total labels
I am using a stacked bar chart displaying a amounts on the x-axis. as the amounts range is huge, I used for the measure formatting a dynamic format to display amounts in Billions/Millions/Kilos or simple decimal numbers.
Data labels use the same measure as the bars, and formatting shows as expected. However, Total labels does not reflect the dynamic formatting as it should. Display units value formatting for both the Data label and Totals label are set to none already.
Screen shots below. I noticed a similar Issue raised in 2023 and 2024 already! Links also below.
Dynamic measure formatting (preview) not displayin... - Microsoft Fabric Community
Dynamic formatting issue with total label in bar c... - Microsoft Fabric Community
Oh, I see. How about trying to overlay two stacked bar charts as a temporary solution?
Create two stacked bar charts:
One with the legend
One without the legend
Enable totals in both charts and position the totals at the outer edge.
In the chart with the legend, make the total value's color transparent using the following code.
Transparent = "#FFFFFF00"At the bottom chart , you can make the bar colors transparent 100% .
The end result should look like this:
11 Replies
- AhmadBakr
Helper IV
Hi danextian, exactly.
In fact I tried it, and what u mentioned was the case.Interesting enough, I went to do some experiments with the sample data table I shared, I discovered that I the data of the first series (the firs legend point) is in the K order, and the total is in the M order, the problem happens! As if the totals are calculating the format from the dynamic format of the first series!
This is not final yet, but I noticed it while exploring this issue.
- danextian
Super User
Did you perhaps change the display units of the total labels to thousands?
- AhmadBakr
Helper IV
Below is fictitious data in a table to illustrate the case.
Use it in a clustered chart (column or bar):
- Put Cat on the category axis: Y-axis if bar chart, X-axis if column chart
- Series in the legend
- Value in the value axis: X-axis if bar chart, Y-axis if column chart
use the following measure:
sumtest = SUM(Formatting[Value])Format this measure as dynamic, and use the below for the dynamic formatting code:VAR val = SELECTEDMEASURE()VAR k = 10^3 VAR m = 10^6 VAR b = 10^9RETURNSWITCH(TRUE(),val >= b, "#,##0,,,.00B",val >= m, "#,##0,,.00M",val >= k, "#,##0,.00K","##0.00")Show Data Labels and Total LabelsFormat Display units for values of Data Labels as "None"Format Display units for values of Total Labels as "None"
Table Name: Formatting
Cat Series ValueA X 1234567 B X 5234567 C X 2345635 D X 123463 A Y 2087654 B Y 2654321 C Y 467375 D Y 3219768 A Z 7098765 B Z 3456721 C Z 2222467 D Z 1114674 The below is the result!
- kushanNa
Super User
Hi AhmadBakr
I couldn’t dig deep into the issue you're facing, but a quick workaround I can suggest for the stacked column chart is to use a Line and Stacked Column Chart and set the line label as the total.
Once you create the line, make its color 100% transparent.
For the data labels, set the display units of all series to None, but keep it as Auto only for the specific measure.
- AhmadBakr
Helper IV
Hello kushanNa. Thank you for your response.
Yes, I thought of the same, however unfortunately I am using a stacked bar chart in my report, hence the fix I am in! I included in my demo a stacked column chart in addition to the bar chart to show the problem is with the stacked charts in general, as it appeared to me.