cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
bml123
Post Patron
Post Patron

Negative value not appearing in stacked bar chart, want to show negative as positive at the top

Hi,

 

I have a stacked column chart with totals and the variance.  If there is a negative value, it's not showing up in the stacked column chart as below.   I want to show the negative amount as positive at the top.  How do I achieve that?

 

bml123_0-1656671463093.png

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @bml123,

Did you mean to summary your records based on value symbol(positive/negative) and display them with positive value?

If that is the case, you can create a table with positive, and negative strings and use new table field on chart legends.

After these steps, you can write a measure fromula with a variable to aggregate value and return different results based on current category values.

formula =
VAR currType =
    SELECTEDVALUE ( NewTable[Type] ) //positive, negative 
RETURN
    SWITCH (
        currType,
        "positive",
            CALCULATE (
                SUM ( Table[Sales] ),
                FILTER ( ALLSELECTED ( Table ), [Sales] > 0 ),
                VALUES ( Table[Category] )
            ),
        "negative",
            CALCULATE (
                ABS ( SUM ( Table[Sales] ) ),
                FILTER ( ALLSELECTED ( Table ), [Sales] < 0 ),
                VALUES ( Table[Category] )
            )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @bml123,

Did you mean to summary your records based on value symbol(positive/negative) and display them with positive value?

If that is the case, you can create a table with positive, and negative strings and use new table field on chart legends.

After these steps, you can write a measure fromula with a variable to aggregate value and return different results based on current category values.

formula =
VAR currType =
    SELECTEDVALUE ( NewTable[Type] ) //positive, negative 
RETURN
    SWITCH (
        currType,
        "positive",
            CALCULATE (
                SUM ( Table[Sales] ),
                FILTER ( ALLSELECTED ( Table ), [Sales] > 0 ),
                VALUES ( Table[Category] )
            ),
        "negative",
            CALCULATE (
                ABS ( SUM ( Table[Sales] ) ),
                FILTER ( ALLSELECTED ( Table ), [Sales] < 0 ),
                VALUES ( Table[Category] )
            )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@bml123 ,

You need to create an absolute measure

 

M1  = abs([measure])



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors