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
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
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.