Forum Discussion
Using Today's date for aging calculation in custom column
- 3 years ago
I was able to figure this out on my own. I did a bit more research on using M and also discovered the Add Conditional Column feature, which got me started on the if then else statement.
#"Added Conditional Column" = Table.AddColumn(#"Reordered Columns2", "Aging", each if [Revised Implementation Date] = null then Duration.Days(today-[Original Estimated Implementation Date]) else Duration.Days(today-[Revised Implementation Date]))
Thanks for getting me started along this path m_dekorte
Cheers
- 3 years ago
Hi CRyley
Great you found a solution on your own!
With the error message I could identify the problem with the code above you were missing a set of parenthesis. That needed to be wrapped around Date.From and the end of the expression, like below.
Duration.Days( today - ( Date.From( [Revised Implementation Date] ) ?? [Original Estimated Implementation Date] ))
Thanks again.
When I click in the whitespace where I'm getting an error, I get:
"Expression.Error: We cannot convert the value #date(2019, 12, 31) to type Duration.
Details:
Value=12/31/2019
Type=[Type]
Any suggestions would be welcome.
Thanks.
I was able to figure this out on my own. I did a bit more research on using M and also discovered the Add Conditional Column feature, which got me started on the if then else statement.
#"Added Conditional Column" = Table.AddColumn(#"Reordered Columns2", "Aging", each if [Revised Implementation Date] = null then Duration.Days(today-[Original Estimated Implementation Date]) else Duration.Days(today-[Revised Implementation Date]))
Thanks for getting me started along this path m_dekorte
Cheers