Forum Discussion
dateDiff in weekdays function
- 4 years ago
Ok,
So the problem here is the null value in the FinalDate Column. The easy fix would be to replace the nulls with the current date before adding the custom function column. And then your code should be working just fine.
#"Replace Value" = Table.ReplaceValue(#"Changed type",null,Date.From(DateTime.LocalNow()),Replacer.ReplaceValue,{"Final Date"})
Did you copy and paste the entire code?
My guess is you've just added the FinalDateCheck line without modifying the rest of the code 🙂
Take a close look - you need to change FinalDate to FinalDateCheck in your calculations.
yup, i've copied all of the code, and tried all of the data types.
The function should give dateDiff in weekdays as whole numbers.
Still unclear what causes the conversion to number error.
I tried changing line 3;
FinalDateCheck = Number.From(each.....
to:
FinalDateCheck = Date.from(each....
and now it gives the same DataFormat.Error except for number it now says date:
can't convert to date
lastly i've removed the spaces between Final Date in line 3, sadly without effect.