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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Issues with Conditional Formatting for calculated measures

Hi friends,

I tried but couldn't figure it out, I have this calculation below which i would like to

1. add the "+" sign for positive variance. so made the change (in red) for my formula and it returns error as it couldn't display.

2. be able to condition format the number , Green if it is positive surplus and red if it is negative.

 

https://app.powerbi.com/groups/me/reports/afde82bd-bc8f-4d2b-9762-afca05016032?ctid=4e3b95cb-ee21-40... 

Entity NameOperating Suplus CYOperating Surplus PY
FE56bane Gi367BC3.3M4.1M
FE56hampton367BC-0.1M1.4M
FE56ich Gir367BC1.4M-0.2M
FE56ich Gra367BC-1.0M0.4M
FE56oomba G367BC-1.6M0.2M
sbanema2.0M8.3M

 

Operating Surplus_CY =

VAR OP_CY =

FORMAT(

CALCULATE(

SUM(Sheet1[Value]),

'End Year'[End Year]

),

"#,##0,.0M")

 

Return

if(OP_CY > 0, "+"&OP_CY,OP_CY")

 

Any kind help is much appreciated

 

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

Hi, @Anonymous 

Please try formula as below:

calculated column:

Operating Surplus_CY =
FORMAT (
    CALCULATE ( SUM ( Sheet1[Value] ), 'End Year'[End Year] ),
    "+#,##0,.0M;-#,##0,.0M"
)

9.png

measure (conditional formatting)

Conditional fomatting =
IF (
    [Operating Suplus CY] > 0,
    "lightgreen",
    [Operating Suplus CY] < 0, "red" )
)

8.png

 

related document:

Custom numeric formats 

 

Best Regards,
Community Support Team _ Eason

 

 

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Please try formula as below:

calculated column:

Operating Surplus_CY =
FORMAT (
    CALCULATE ( SUM ( Sheet1[Value] ), 'End Year'[End Year] ),
    "+#,##0,.0M;-#,##0,.0M"
)

9.png

measure (conditional formatting)

Conditional fomatting =
IF (
    [Operating Suplus CY] > 0,
    "lightgreen",
    [Operating Suplus CY] < 0, "red" )
)

8.png

 

related document:

Custom numeric formats 

 

Best Regards,
Community Support Team _ Eason

 

 

amitchandak
Super User
Super User

@Anonymous , Try like

 

Operating Surplus_CY =

VAR OP_CY =
CALCULATE(
SUM(Sheet1[Value]),
'End Year'[End Year]
)

var _2 = format(OP_CY,"#,##0,.0M")

 

Return

if(OP_CY > 0, "+"& _2, _2)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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