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
dokat
Post Prodigy
Post Prodigy

CONDITIONAL FORMATTING BASED ON TWO CALCULATED MEASURE

Hi,

 

Is it possible to have conditional formating based on two calculated measures in row card.

 

Hi,

 

I have a row card that has YoY % growth calculation as a measure. In addition to YoY growth i'd like to add a condition if the number is greater than >0% highlight data in green if it's below 0 highlight in red.

 

Current formula

if ( (CALCULATE(('P&L'[2021]), 'P&L'[P&L] in { "Customer NS"})/CALCULATE(('P&L'[2021]), 'P&L'[P&L] in { "Customer NS"})-1)

>

(CALCULATE(('P&L'[2020]), 'P&L'[P&L] in { "Customer NS"})/CALCULATE(('P&L'[2020]), 'P&L'[P&L] in { "Customer NS"})-1), Green Format otherwise red.

 

Is it possible to do this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@dokat , You can create color measure with different conditions and use that in conditional formatting using field value option

 

color =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0 && [Net Sales YTD] > 0 , "green",
_change = 0, "blue",
_change < 0, "red"
)

 

or

 

color =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0 && not(isblank([Net Sales YTD]))  , "green",
_change = 0, "blue",
_change < 0, "red"
)

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@dokat , You can create color measure with different conditions and use that in conditional formatting using field value option

 

color =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0 && [Net Sales YTD] > 0 , "green",
_change = 0, "blue",
_change < 0, "red"
)

 

or

 

color =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0 && not(isblank([Net Sales YTD]))  , "green",
_change = 0, "blue",
_change < 0, "red"
)

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

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.