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
WaelTalaat79
Helper I
Helper I

Color Text

Dears,
i have this DAX formula and it shows as text because it contains % and Value in the same column

I need to color in read the text in negative

 

Margin Gap =
Var _MarginPercent = (DIVIDE([Margin Value],SUM('Sales'[Tot Sales])))
Var _MarginContract = MAX('Contract details'[Margin %])
Var _Marginvalue = (SUM('Sales'[Tot Sales]))-(SUM('Value'[Purchases]))
Var _MarginQTY = (_Marginvalue)/SUM('Value'[Invoice Qty])
VAR _Supplier = MAX('Value'[Supp.# & Name])
return
((IFERROR((IF(_Supplier="5927 MAHMOOD MALLIK INTERNATIONAL G.T", ((_MarginQTY)-(_MarginContract)),IF(_Supplier="6784 JUST FRIENDS CATERING SERVICES", ((_MarginQTY)-(_MarginContract)), FORMAT((_MarginPercent- _MarginContract), "0.##%")))),0)))WaelTalaat79_0-1700561899762.png

 

 
WaelTalaat79_1-1700561904220.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @WaelTalaat79 

You can create a measure to format.

Format = IF(CONTAINSSTRING([Margin Gap],"-"),"red","green")

Then put it to the conditional formatting of the [Margin Gap] measure, select font color.

vxinruzhumsft_0-1700704423800.png

Then set the condition.

vxinruzhumsft_1-1700704465243.png

Output

vxinruzhumsft_2-1700704477781.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
WaelTalaat79
Helper I
Helper I

Thanks

Anonymous
Not applicable

Hi @WaelTalaat79 

You can create a measure to format.

Format = IF(CONTAINSSTRING([Margin Gap],"-"),"red","green")

Then put it to the conditional formatting of the [Margin Gap] measure, select font color.

vxinruzhumsft_0-1700704423800.png

Then set the condition.

vxinruzhumsft_1-1700704465243.png

Output

vxinruzhumsft_2-1700704477781.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.