Hi @karti1507 ,
I suggest you try this code to create a measure.
Measure =
VAR _PREVIOUSDATE =
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[City] = MAX ( 'Table'[City] )&& 'Table'[Company] = MAX ( 'Table'[Company] )&& 'Table'[Site] = MAX ( 'Table'[Site] )&& 'Table'[Date Provided] < MAX ( 'Table'[Date Provided] )
),
'Table'[Date Provided]
)
VAR _FUTUREDATE =
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[City] = MAX ( 'Table'[City] )&& 'Table'[Company] = MAX ( 'Table'[Company] )&& 'Table'[Site] = MAX ( 'Table'[Site] )&& 'Table'[Date Provided] > MAX ( 'Table'[Date Provided] )
),
'Table'[Date Provided]
)
VAR _DAYDIFF1 =
DATEDIFF ( _PREVIOUSDATE, MAX ( 'Table'[Date Provided] ), DAY )
VAR _DAYDIFF2 =
DATEDIFF ( MAX ( 'Table'[Date Provided] ), _FUTUREDATE, DAY )
RETURN
IF ( _DAYDIFF1 > 3 || _DAYDIFF2 > 3, "Red" )Then set the conditional formatting for [Date Provided] column.
![vrzhoumsft_0-1724897500024.png vrzhoumsft_0-1724897500024.png]()
Result is as below.
![vrzhoumsft_1-1724897577602.png vrzhoumsft_1-1724897577602.png]()
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.