Forum Discussion
DAX Function To Compare 3 Different Dates-Timestamps Columns
- 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:)
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 ![]()
AlB thank you for the quick reply. FYI am using powerpivot in Excel. Your formula structure/syntax looks different, will it still work or do I have to modify it before applying it??
- AlB7 years ago
Community Champion
Should be the same. The DAX engine is the same in both cases
- Anonymous7 years agoNot applicable
I pasted formula and replaced Table 1 with my table name but I get the following error
"Failed to resolve name 'NewCol' it is not a valid table, variable or function name"
Sorry I'm a bit of a newbie and still learning....
- AlB7 years ago
Community Champion
NewCol is the name of the new column. The DAX code for the column is the rest so enter everything without the "NewCol ="
(or maybe with the = at the beginning, I don't remember if it's included by default in Power Pivto when you define a calculated column)
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
