Checking 2 set of dates to see if there are errors

Hi, I just start to learn DAX, frustrating at my 1st trial: while checking 2 sets of dates to see if there are errors (say end date should be greater than start date), I put (my 1st ever) a DAX) like this:

CheckReceived-ClosedDateTable =
VAR DateReceived = FILTER(ActionPlanReview, ActionPlanReview[Date Received])
VAR DateClosed = FILTER(ActionPlanReview, ActionPlanReview[Date Closed])
RETURN
IF( DateReceived < DateClosed, “Good Dates”) &&
IF( DateReceived > DateClosed, “Bad Dates or Null”) &&
IF( DateReceived = DateClosed, “Same Dates”)

But it doesn’t work. Please advise me.
Thanks a lot!

You can simply use DATEDIFF.

CheckReceived-ClosedDateTable =
VAR DIFF =
DATEDIFF ( ActionPlanReview[Date Received], ActionPlanReview[Date Closed], DAY)
RETURN
IF ( DIFF > 0, “Good dates”,
IF ( DIFF = 0, “Sames Dates”,
“Bad Dates” ) )

Thank you so much, [HASSAN_BI]!

Just tried and it works!

I just joint membership here a couple of days ago, feel like you all here are experts!

Really appreciated!

1 Like

You are welcome !
It takes time to learn, that’s alright. We’ll are still learning anyway.
Please mark this as a solution.
Good luck