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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-xinruzhu-msft
Community Support
Community Support

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

v-xinruzhu-msft
Community Support
Community Support

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.