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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
likhitha2705
Frequent Visitor

Conditional for Negative number and Negative Percentage in a single measure

Hello All,
        I've created a table by manually entering the Data as Sales and Gross Margin as rows.
And I wrote a DAX like this

Test =
IF(SELECTEDVALUE('Table'[Column1])="Sales",[TotalSales],
IF(SELECTEDVALUE('Table'[Column1])="Gross Margin",FORMAT([Gross Rev.Margin],"Percent")))
Now I want to do Conditional Foormatting for the above measure.The Condition is as follows 
If([Test] <0 ,"Red","Green")
With the above measure the conditional Formatting is effecting only Sales(It's currency Value) but not the Gross Margin.(it's in Percentage)
Is there any way to achieve this?
TIA
1 REPLY 1
ray_aramburo
Super User
Super User

I would recommend to separate your measures or even the columns. The moment you format the percentage one it turns into text and you lose the ability to evaluate with numerical logic. So, create a separate column that formats it as text and use the numerical one to evaluate the logic.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.