Forum Discussion

Ahollis's avatar
Ahollis
Regular Visitor
2 years ago

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

 

3 Replies

  • v-weiyan1-msft's avatar
    v-weiyan1-msft
    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:

    Please try code as below to create measure.

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

    Result is as below.

    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.

    Result is as below.


    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.

  • Ahollis's avatar
    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

     

    • v-weiyan1-msft's avatar
      v-weiyan1-msft
      Community Support

      Hi Ahollis ,

       

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

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

      Result is as below.

      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.


      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.