Forum Discussion
DATEDIFF with blank dates
- Anonymous9 years ago
What days do you want to return for those blank end dates? If you want to return the days between start date and today when the end date us blank, you can use the following DAX to calculate age of the record.
Column = IF(ISBLANK(Table[End Date]),DATEDIFF(Table[Start Date],TODAY(),DAY),DATEDIFF(Table[Start Date],Table[End Date],DAY))
Regards,
What days do you want to return for those blank end dates? If you want to return the days between start date and today when the end date us blank, you can use the following DAX to calculate age of the record.
Column = IF(ISBLANK(Table[End Date]),DATEDIFF(Table[Start Date],TODAY(),DAY),DATEDIFF(Table[Start Date],Table[End Date],DAY))
Regards,
- anongard9 years agoHelper I
Thank you! Related, but more difficult question:
In PowerQuery, I'm trying to replicate this DAX function: TestCourse = IF(Courses[CompletedDate] > Courses[ActivationDate],TRUE,FALSE)
However, nothing I've tried in M has worked. I tried first with
= if Courses[CompletedDate] > Courses[ActivationDate]
then "TRUE"
else "FALSE"
but I get errors about cyclic references and nothing very helpful to resolve it. If I could sort / filter in the DAX view that would be even better, but I suppose that's the entire point...
Thanks,
Alex
- Anonymous9 years agoNot applicable
anongard,
I am not able to reproduce your issue. In Query Editor, add a custom column as shown in the following screenshot.
Regards,- anongard9 years agoHelper I
I was able to solve this with conditional columns, thankfully. I don't know why it worked for you though, I have literally the exact same thing typed in mine and I still get cyclic errors. Is there something that could be giving it trouble in the data?
- user-20214 years agoNew Member
hello - instead of using TODAY is there a way to calculate it from date slicer.
Column = IF(ISBLANK(Table[End Date]),DATEDIFF(Table[Start Date],TODAY(),DAY),DATEDIFF(Table[Start Date],Table[End Date],DAY))
Thank you.