Forum Discussion
How do I use a table column to calculate the Duration.Days of overdue invoices? (Syntax?)
I have been trying to get this calculation column together, but have not been able to succeed. If the syntax is Value.ReplaceType(any value, new type) what's going on with this error code? I thought Duration.Days requires numbers, not dates, so how do I convert it?
M Query
Error Code
If you have any better routes to take, I'm all ears. I just want to be able to upload an excel report, and based on the invoice date show me how many days old it is.
Side curiosity, is there a difference between Referencing and Duplicating a table? I feel like there must be but I can't figure it out.
I don't know where you got that idea. But:
= Table.AddColumn(#"Previous Step", "Duration", each Duration.Days(Date.From(DateTime.LocalNow()) - [Invoice Date]), Int64.Type)Replace #"Previous Step" with the name of the Step preceding this line of code that contains the table to which you want to add the "Duration" column
2 Replies
- ronrsnfld
Super User
I don't know where you got that idea. But:
= Table.AddColumn(#"Previous Step", "Duration", each Duration.Days(Date.From(DateTime.LocalNow()) - [Invoice Date]), Int64.Type)Replace #"Previous Step" with the name of the Step preceding this line of code that contains the table to which you want to add the "Duration" column
- Marissa_AustinRegular Visitor
Thank you! A lot of this I'm able to work through based on intuition and the definition guide, but I was pulling my hair out with that one. Worked like a charm!