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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
anwilkins
Resolver II
Resolver II

Conditionally format when a date is reached

I need to create an alert of any type that shows a patient is about to turn 21. I have the following columns:

Name   /   21st birthday   /   90 Day Alert  

I want the Patient Name cell to either turn yellow or the font change on the date of the 90 day alert and remain highlighted.

Sample:

Name   /   21st birthday   /   90 Day Alert  

Ashley  /   06/15/2022   /     03/15/2022

John    /  11/01/2022   /     08/01/2022

Mary  /   08/22/2022    /    05/22/2022

 

Thanks in advance

1 ACCEPTED SOLUTION
johncolley
Solution Sage
Solution Sage

Hi @anwilkins ,

 

Create the following measure, you can change the colours I've specified to whatever you want. 

Colouring = 
var alert = SELECTEDVALUE(Birthday[90 Day Alert])
var result = SWITCH(
TRUE(),
alert <= TODAY(), "Red",
"Black")
return
result

Then in the table formatting settings, select Cell Elements, choose the column you want to format and choose background or font conditional formatting, select Field Value and choose the Colouring measure.

Example output below:

johncolley_0-1655348798487.png

 

View solution in original post

3 REPLIES 3
johncolley
Solution Sage
Solution Sage

Hi @anwilkins ,

 

Create the following measure, you can change the colours I've specified to whatever you want. 

Colouring = 
var alert = SELECTEDVALUE(Birthday[90 Day Alert])
var result = SWITCH(
TRUE(),
alert <= TODAY(), "Red",
"Black")
return
result

Then in the table formatting settings, select Cell Elements, choose the column you want to format and choose background or font conditional formatting, select Field Value and choose the Colouring measure.

Example output below:

johncolley_0-1655348798487.png

 

Thanks John! I had found a solution by creating another column but I like your measure approach so much more! I'm just starting to use SWITCH TRUE so thanks for sharing this new approach. here's my sad but working solution...three new columns...ugh...

*AlertFlag = if (Now() >= 'MERGE_BillingSUMMARY'[*90 Day Alert],1)
*90 Day Alert = ('MERGE_BillingSUMMARY'[*21st BD Date] - 90)
*21st BD DateDATE ( YEAR ( MERGE_BillingSUMMARY[Patient Birthdate] ) + 21, MONTH ( MERGE_BillingSUMMARY[Patient Birthdate] ), DAY ( MERGE_BillingSUMMARY[Patient Birthdate] ) )

Glad it works for you! It's quite a simple, but versatile function particularly for conditional formatting.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors