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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Emma_
Helper I
Helper I

DAX Adjustment for negative % values

Hello,

I would like to make a correction for my % values displayed on the bar chart as additional labels (details labels) so that we do not see any negative values or values above 100%. Absolute values should be displayed as they are (actuals). Does anyone know how to fix this in DAX? Thank you for help.

 actualspositive value adjusted only for % calculation purpose (intermediate step)% actuals% positiv value adjusted (final result)
     
Client Group 1          -35'106                    35'106-18.213.3
Client Group 2         228'283                 228'283118.286.7
Total         193'177                 263'389  
2 ACCEPTED SOLUTIONS
burakkaragoz
Community Champion
Community Champion

Hi @Emma_ ,

 

You need to create an adjusted percentage measure that caps values between 0% and 100%. Here's the DAX solution:

Create this measure for your adjusted percentage:

Adjusted Percentage = 
VAR TotalValue = SUM(YourTable[Total])
VAR CurrentValue = SUM(YourTable[Actuals])
VAR RawPercentage = DIVIDE(CurrentValue, TotalValue, 0)
VAR AdjustedPercentage = 
    SWITCH(
        TRUE(),
        RawPercentage < 0, 0,
        RawPercentage > 1, 1,
        RawPercentage
    )
RETURN AdjustedPercentage

Alternative cleaner version:

Capped Percentage = 
VAR RawPct = DIVIDE([Actuals], [Total], 0)
RETURN 
MIN(MAX(RawPct, 0), 1)

This uses MIN/MAX functions to cap the percentage between 0 and 1 (0% and 100%).

For your bar chart labels:

  • Keep using your original [Actuals] measure for the bar values
  • Use the new [Adjusted Percentage] measure for the data labels
  • Format the percentage measure to show as percentage with desired decimal places

Quick tip: If you want to show both actual values and adjusted percentages as labels, you can create a combined measure:

Combined Label = 
[Actuals] & " (" & FORMAT([Adjusted Percentage], "0.0%") & ")"

This way your negative actuals still show as-is, but percentages are properly capped for visual clarity.


If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.

View solution in original post

DataNinja777
Super User
Super User

Hi @Emma_ ,

 

To fix your percentage display, you can create a DAX measure that adjusts the calculation to show a category's contribution to a total made of only positive values. This approach ensures no percentage is negative or that the total exceeds 100%. The final result is the proportion of each category's absolute value against the sum of all absolute values.

 

Here is the DAX measure to achieve this. You should replace 'YourTable'[Client Group] with the actual column from your data model that contains the categories. Also, replace [Actuals] if your base measure has a different name.

% Adjusted = 
VAR _AbsoluteActual =
    ABS ( [Actuals] )
VAR _TotalAbsoluteSum =
    SUMX ( ALLSELECTED ( 'YourTable'[Client Group] ), ABS ( [Actuals] ) )
VAR _Result =
    DIVIDE ( _AbsoluteActual, _TotalAbsoluteSum )
RETURN
    _Result

This formula works by first using a variable, _AbsoluteActual, to get the positive equivalent of your [Actuals] value for the current category on the chart. Next, the _TotalAbsoluteSum variable calculates the new denominator. It does this by using SUMX to iterate over all selected client groups (ALLSELECTED) and sums their absolute values, effectively creating the 263,389 total from your example. Finally, the formula safely divides the category's absolute value by the total sum of absolute values.

 

After creating this new measure, you must format it as a percentage using the "Measure tools" in Power BI. You can then use this % Adjusted measure as the data label on your bar chart to display the corrected values.

 

Best regards,

View solution in original post

3 REPLIES 3
Emma_
Helper I
Helper I

Thank you.

DataNinja777
Super User
Super User

Hi @Emma_ ,

 

To fix your percentage display, you can create a DAX measure that adjusts the calculation to show a category's contribution to a total made of only positive values. This approach ensures no percentage is negative or that the total exceeds 100%. The final result is the proportion of each category's absolute value against the sum of all absolute values.

 

Here is the DAX measure to achieve this. You should replace 'YourTable'[Client Group] with the actual column from your data model that contains the categories. Also, replace [Actuals] if your base measure has a different name.

% Adjusted = 
VAR _AbsoluteActual =
    ABS ( [Actuals] )
VAR _TotalAbsoluteSum =
    SUMX ( ALLSELECTED ( 'YourTable'[Client Group] ), ABS ( [Actuals] ) )
VAR _Result =
    DIVIDE ( _AbsoluteActual, _TotalAbsoluteSum )
RETURN
    _Result

This formula works by first using a variable, _AbsoluteActual, to get the positive equivalent of your [Actuals] value for the current category on the chart. Next, the _TotalAbsoluteSum variable calculates the new denominator. It does this by using SUMX to iterate over all selected client groups (ALLSELECTED) and sums their absolute values, effectively creating the 263,389 total from your example. Finally, the formula safely divides the category's absolute value by the total sum of absolute values.

 

After creating this new measure, you must format it as a percentage using the "Measure tools" in Power BI. You can then use this % Adjusted measure as the data label on your bar chart to display the corrected values.

 

Best regards,

burakkaragoz
Community Champion
Community Champion

Hi @Emma_ ,

 

You need to create an adjusted percentage measure that caps values between 0% and 100%. Here's the DAX solution:

Create this measure for your adjusted percentage:

Adjusted Percentage = 
VAR TotalValue = SUM(YourTable[Total])
VAR CurrentValue = SUM(YourTable[Actuals])
VAR RawPercentage = DIVIDE(CurrentValue, TotalValue, 0)
VAR AdjustedPercentage = 
    SWITCH(
        TRUE(),
        RawPercentage < 0, 0,
        RawPercentage > 1, 1,
        RawPercentage
    )
RETURN AdjustedPercentage

Alternative cleaner version:

Capped Percentage = 
VAR RawPct = DIVIDE([Actuals], [Total], 0)
RETURN 
MIN(MAX(RawPct, 0), 1)

This uses MIN/MAX functions to cap the percentage between 0 and 1 (0% and 100%).

For your bar chart labels:

  • Keep using your original [Actuals] measure for the bar values
  • Use the new [Adjusted Percentage] measure for the data labels
  • Format the percentage measure to show as percentage with desired decimal places

Quick tip: If you want to show both actual values and adjusted percentages as labels, you can create a combined measure:

Combined Label = 
[Actuals] & " (" & FORMAT([Adjusted Percentage], "0.0%") & ")"

This way your negative actuals still show as-is, but percentages are properly capped for visual clarity.


If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors