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
azakir
Resolver I
Resolver I

Conditional Formatting based on different dates

Hi Guys. I am working on a report which requires me to do coditional format based on 3 different dates: 

 

azakir_0-1660290526914.png

In the image below I want to define the first grey box by a date, then the greens/purples by another date and then a third and final date to end the greens. effectively what I'm trying to do is show the contract period in the greens and with the grey show the time between likely award date and start date.

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@azakir , You need create a color measure based on date/measure etc. And use that in conditional formatting using field value option

 

example

Color Date = if(FIRSTNONBLANK('Date'[Date],TODAY()) < date(2022,04,10) ,
Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .75 , "Amber" ,
"Red "
) ,Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .5 , "Amber" ,
"Red "
)
)

 

Color Date =
var _min =minx(allselected(Date,Date[Year])
return
Switch( true(),
FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"lightgreen",
FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"blue",
"red")

 

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@azakir , You need create a color measure based on date/measure etc. And use that in conditional formatting using field value option

 

example

Color Date = if(FIRSTNONBLANK('Date'[Date],TODAY()) < date(2022,04,10) ,
Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .75 , "Amber" ,
"Red "
) ,Switch(true(),
[SLA] = 1 , "Green" ,
[SLA] >= .5 , "Amber" ,
"Red "
)
)

 

Color Date =
var _min =minx(allselected(Date,Date[Year])
return
Switch( true(),
FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"lightgreen",
FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"blue",
"red")

 

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

Hi @amitchandak 

Thanks for this, this helps. Would this work if we are working on three different date fields? 

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.