Forum Discussion
Percentage data labels for stacked column chart
- 2 years ago
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:
- For the "Total Sales" data label, use the "Total Sales Label" measure.
- For the "Target Sales" data label, use the "Target Sales Label" measure.
- For the "Percentage of Target Sales" data label, use the "Percentage Label" measure.
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:
- For the "Total Sales" data label, use the "Total Sales Label" measure.
- For the "Target Sales" data label, use the "Target Sales Label" measure.
- For the "Percentage of Target Sales" data label, use the "Percentage Label" measure.
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.