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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
the606
Helper I
Helper I

Issue with conditional formatting on a new column

Hi,

 

Moving on from an issue i had before i have created a new column, i only want the column to register "#F68D39" if the number of days from Query1[SI Instruction] until today are over 15 days and there is a zero in the KPI_3 field.

 

There may not be a date yet so as a consequence i think i need to add an extra function to check if a date is present in the SI instruction field.

 

I have tried the below but i cant figure out how to get it to look at a third field to see if the date is present first.

 

Colour KPI3 =
VAR diff =
DATEDIFF ( Query1[SI Instruction],TODAY () , DAY )
RETURN
IF ( AND ( Query1[KPI_3] = 0.00, diff < 15 ), "#F68D39" )
1 REPLY 1
AlexisOlson
Super User
Super User

You can handle the diff separately for blank values like this

 

Colour KPI3 =
VAR diff =
    IF (
        ISBLANK ( Query1[SI Instruction] ),
        0,
        DATEDIFF ( Query1[SI Instruction], TODAY (), DAY )
    )
RETURN
    IF ( AND ( Query1[KPI_3] = 0.00, diff < 15 ), "#F68D39" )

 

Or you could add another condition to your IF

 

Colour KPI3 =
VAR diff =
    DATEDIFF ( Query1[SI Instruction], TODAY (), DAY )
RETURN
    IF (
        NOT ( ISBLANK ( Query1[SI Instruction] ) )
            && Query1[KPI_3] = 0.00
            && diff < 15,
        "#F68D39"
    )

 

Or you could nest IF functions... It really depends on what you're trying to do.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.