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

Be 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

Reply
DaxPadawan
Helper III
Helper III

Percentage data labels for stacked column chart

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.

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

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:

  1. 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.

 

 

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

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:

  1. 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.

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.