Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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?
Solved! Go to Solution.
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
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
@bml123 ,
You need to create an absolute measure
M1 = abs([measure])
Check out the November 2023 Power BI update to learn about new features.