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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.