Forum Discussion
exclude text values when using DATEDIFF
- 3 years ago
Hey TIGER8855
you can do this with two steps in Power Query, create a new column with this code
try Date.FromText ([maybe a Date] )
otherwise null
Then change the data type to Date
This result might look like this:Hopefully this provides what you are looking for.
Regards,
Tom
Hey TIGER8855 ,
this will not work because the DATEDIFF function requires the argument to be either of data type DATE or DATETIME: DATEDIFF – DAX Guide
Regards,
Tom
Thanks TomMartens . Do you know what is the easiest way to create a new column with just the dates and if there is text, the cell in the new column is blank? This way I can use the DATEDIFF on the new column with only the dates.
- TomMartens3 years agoSuper User
Hey TIGER8855
you can do this with two steps in Power Query, create a new column with this code
try Date.FromText ([maybe a Date] )
otherwise null
Then change the data type to Date
This result might look like this:Hopefully this provides what you are looking for.
Regards,
Tom- TIGER88553 years agoHelper I
Thanks TomMartens. That works. My original DATEDIFF can now be used on this new column.