Forum Discussion
DAX Function To Compare 3 Different Dates-Timestamps Columns
Hi,
Am using Powerpivot and I have 3 columns, each with date & time scans in them. The 3 columns occur in the exact sequence as shown below: (i.e. Job booking date occurs first, then Attempted Acceptance Date, then Acceptance Date)
- Job Booking Date
- Attempted Acceptance Date
- Acceptance Date
I have a calculated column called BEFORE 12 SCAN and I need a function to determine the following logic:
if Job Booking Date < 12:00 midday, AND Attempted Acceptance Date < 12:00 midday (on the same day) AND Acceptance Date < 12:00 midday (on the same day), then output "YES", else "NO" in BEFORE 12 SCAN column
Note: Job booking has NO blank cells but Attempted Acceptance Date and Acceptance Date may have blank cells.
Appreciate any help:)
- Anonymous7 years ago
Yes that worked and powerpivot does include = at beginning by default.
Sorry its my first time seeing such a long formula and didn't know you could include variables in a formula which is awesome.
Thank you again for your help, much appreciated:)
- Anonymous7 years ago
AlB its ok I've managed to fix issue myself after some manual testing. Thanks again:)
12 Replies
- AlB
Community Champion
Hi Anonymous
Try this
NewCol = VAR Time1_ = HOUR(Table1[Job Booking Date]) VAR Time2_ = HOUR(Table1[Attempted Acceptance Date]) VAR Time3_ = HOUR(Table1[Acceptance Date]) VAR Date1_ = INT(Table1[Job Booking Date]) VAR Date2_ = INT(Table1[Attempted Acceptance Date]) VAR Date3_ = INT(Table1[Acceptance Date]) VAR SameDate_ = (Date1_ = Date2_) && (Date2_ = Date3_) RETURN IF( SameDate_ && Time1_ < 12 && Time2_ < 12 && Time3_ < 12, "Yes", "No")
Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.
Cheers
