March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello!
I have a stacked column chart where the x-axis is Category (from a dim_Category table) and the y-axis are Target Sales and Total Sales (which is actually a measure of Total Sales - Target Sales). They are both from different tables.
I want the data labels on the chart to show the Total Sales, the Target Sales, and the percentage of Target Sales. I was able to show Total Sales by enabling "Total labels". The last two I am having trouble with. I was able to make a measure that shows "1,233,455 55%" and use that as my custom data label for Target Sales. However, it all shows up on one line and is quite ugly, especially when more bars are added.
Are there any alternatives I can pursue? I wanted to try and make the data label look like
1,233,455
55%
but the UNICHAR(10) method doesn't seem to work.
Solved! Go to Solution.
To achieve the desired data label format where you have Total Sales, Target Sales, and the percentage of Target Sales displayed on separate lines in a stacked column chart, you can use a combination of DAX measures and custom formatting. Unfortunately, the UNICHAR(10) method doesn't work for creating line breaks in data labels. However, you can achieve this by creating separate measures and formatting them appropriately.
Here's how you can do it:
Total Sales Label Measure: Create a DAX measure that calculates the Total Sales and formats it as a string.
Total Sales Label = FORMAT([Total Sales], "#,##0")
Target Sales Label Measure: Create another DAX measure that calculates the Target Sales and formats it as a string.
Target Sales Label = FORMAT([Target Sales], "#,##0")
Percentage of Target Sales Measure: Create a DAX measure to calculate the percentage of Target Sales.
Percentage of Target Sales = DIVIDE([Target Sales], [Total Sales])
Percentage Label Measure: Create a measure that combines the percentage value with a "%" symbol.
Percentage Label = FORMAT([Percentage of Target Sales], "0%")
Now, you have four measures: Total Sales Label, Target Sales Label, Percentage of Target Sales, and Percentage Label.
Next, in your stacked column chart, you can use these measures for data labels:
This should give you the desired format with each value on a separate line in your data labels:
1,233,455
55%
By using separate measures, you can control the formatting of each part of the data label and achieve the desired appearance in your stacked column chart.
To achieve the desired data label format where you have Total Sales, Target Sales, and the percentage of Target Sales displayed on separate lines in a stacked column chart, you can use a combination of DAX measures and custom formatting. Unfortunately, the UNICHAR(10) method doesn't work for creating line breaks in data labels. However, you can achieve this by creating separate measures and formatting them appropriately.
Here's how you can do it:
Total Sales Label Measure: Create a DAX measure that calculates the Total Sales and formats it as a string.
Total Sales Label = FORMAT([Total Sales], "#,##0")
Target Sales Label Measure: Create another DAX measure that calculates the Target Sales and formats it as a string.
Target Sales Label = FORMAT([Target Sales], "#,##0")
Percentage of Target Sales Measure: Create a DAX measure to calculate the percentage of Target Sales.
Percentage of Target Sales = DIVIDE([Target Sales], [Total Sales])
Percentage Label Measure: Create a measure that combines the percentage value with a "%" symbol.
Percentage Label = FORMAT([Percentage of Target Sales], "0%")
Now, you have four measures: Total Sales Label, Target Sales Label, Percentage of Target Sales, and Percentage Label.
Next, in your stacked column chart, you can use these measures for data labels:
This should give you the desired format with each value on a separate line in your data labels:
1,233,455
55%
By using separate measures, you can control the formatting of each part of the data label and achieve the desired appearance in your stacked column chart.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
82 | |
69 | |
53 | |
44 |
User | Count |
---|---|
202 | |
106 | |
100 | |
64 | |
56 |