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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ahollis
Regular Visitor

Clustered bar chart negative value

Hello, any way to adjust the negative value as an absolute value for my bar chart below without impacting the source data?  i would like to see the bar to the right rather than the left....

Ahollis_0-1710954329714.png

 

3 REPLIES 3
Ahollis
Regular Visitor

Thanks Yulia this should work!  However what if my selected value is a Measure?  this is where the bar chart is pulling values from

Ahollis_0-1711040200731.png

Ahollis_1-1711040246707.png

 

Hi @Ahollis ,

 

Based on your additional instructions, you can try code as below to create measure.
My Sample:

vweiyan1msft_0-1711071765276.png

Amount = SELECTEDVALUE('Table'[Value])
Actual MTD = CALCULATE(ABS([Amount]), 'Table'[Scenario] = "MTD" )

Result is as below.

vweiyan1msft_1-1711071823102.png

Regarding the conditional formatting, use the following code to create a measure.

Measure = 
VAR MTD_ = CALCULATE('Table'[Amount],FILTER('Table','Table'[Scenario] = "MTD"))
RETURN
IF ( MTD_ > 0, 1, 0 )

Please refer to the previous reply for details about specific operation.
Result is as below.

vweiyan1msft_2-1711072017139.png


Best Regards,
Yulia Yan


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-weiyan1-msft
Community Support
Community Support

Hi @Ahollis ,

 

Currently Power BI does not support displaying negative values as positive (absolute) values directly on bar charts without modifying the source data. However, you may consider trying the following method to achieve a similar visualization.
My Sample:

vweiyan1msft_0-1711000211832.png

Please try code as below to create measure.

MTD_Value = 
VAR MTD_ = SELECTEDVALUE('Table'[MTD])
RETURN
ABS(MTD_)

Result is as below.

vweiyan1msft_1-1711000254201.png

To visually distinguish between original positive and negative values, you can apply conditional formatting:
1. Use the following code to create a measure.

Measure = 
VAR MTD_ = SELECTEDVALUE ( 'Table'[MTD] ) 
RETURN IF ( MTD_ > 0, 1, 0 )

2. Then select your visual object and do the following in the Visualizations pane.

vweiyan1msft_2-1711000294945.png

vweiyan1msft_3-1711000308620.png

Result is as below.

vweiyan1msft_4-1711000336434.png


Best Regards,
Yulia Yan


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.