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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

two dates comparison with +- comparision

I have two Date fields as below
 
ACTUAL_DATEPREDICTION_DATESTATUS
10/30/2020nullNO_RESULT
10/28/2020nullNO_RESULT
10/8/202010/9/2020TRUE
10/10/202010/9/2020TRUE
10/15/202010/9/2020FALSE

 i wanted to have a calculated column(STATUS) which would display true if  actual date is +- 2 days  from PRED_POD_TS
And display NO val if PREDICTION_DATE is null

for example 

1) actual date is 8th Oct and PREDICTION_DATE is 9th OCT then display column as true
2) actual date is 10th Oct and PREDICTION_DATE is 9th OCT then display column as true
3)actual date is 15th Oct and PREDICTION_DATE is 9th OCT then display column as False


 
is this possible?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like


Switch( True(),
isblank([PREDICTION_DATE]) ,"NO_RESULT",
abs(datediff([ACTUAL_DATE],[PREDICTION_DATE],day))<=2, "TRUE",
"FALSE"
)

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try a new column like


Switch( True(),
isblank([PREDICTION_DATE]) ,"NO_RESULT",
abs(datediff([ACTUAL_DATE],[PREDICTION_DATE],day))<=2, "TRUE",
"FALSE"
)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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