Forum Discussion
Datediff
Trying to get number of days between 2 dates - have done multiple different options and DATEDIFF is giving me these errors:
"The third argument Interval can only be one of the following: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND."
Previously it was giving me this error:
"The syntax for 'TODAY' is incorrect. (DAX(Datediff([sys_created_on].[Day]TODAY()))).
OR most frequently
Too few arguments were passed to the DATEDIFF function. The minimum argument count for the function is 3."
Each time I try to include DATEDIFF option - current one is
Hi Anonymous ,
Assuming you are making a calculated column your syntax needs to be the following:
Column = DATEDIFF(Table[sys_created_on].[Day]; TODAY();DAY)Regarding the errors you are having is refering to the fact that you don't have the third parameter on the DATEDIFF function on the option above the calculation is made in days however if you make that parameter in any of those refered (YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND) the result will be accordingly to that.
Another thing is date you are placing the .[day] when refering to your column that will give you a calculation based on the day of the date and not the all date giving you and unexpected result.
If you are refering to a measure your syntax need to be similar to this:
Measure = DATEDIFF(SELECTEDVALUE('Table'[sys_created_on]); TODAY(); DAY)Regards,
MFelix
1 Reply
- MFelixSuper User
Hi Anonymous ,
Assuming you are making a calculated column your syntax needs to be the following:
Column = DATEDIFF(Table[sys_created_on].[Day]; TODAY();DAY)Regarding the errors you are having is refering to the fact that you don't have the third parameter on the DATEDIFF function on the option above the calculation is made in days however if you make that parameter in any of those refered (YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND) the result will be accordingly to that.
Another thing is date you are placing the .[day] when refering to your column that will give you a calculation based on the day of the date and not the all date giving you and unexpected result.
If you are refering to a measure your syntax need to be similar to this:
Measure = DATEDIFF(SELECTEDVALUE('Table'[sys_created_on]); TODAY(); DAY)Regards,
MFelix