Forum Discussion
Help Turn Around Time and Ageing calculation
hi expert,
I need to calculate the turnaround time and age and I did this process on custom column. unfortunately, Im having encounter error and no values displayed on column. Any idea on what missing on my code or it is advisable to do this in dataset column or custom column. Please see below code. Any help is very much appreciated.
= Table.AddColumn(#"Added Conditional Column", "Custom new TAT0", each if [build]=1 and [r1_id]=null and [r2_id]=null and [r3_id] = null then DateTime.From([input_date]) - DateTime.From(DateTime.LocalNow) else "")
Thank you in advance.
Hi Anonymous
Your code just lacks a pair of parentheses after DateTime.LocalNow function. Every function should have a pair of parentheses at the end no matter there is any argument in it or not.
= Table.AddColumn(#"Changed Type", "Custom", each if [build]=1 and [r1_id]=null and [r2_id]=null and [r3_id] = null then DateTime.From([input_date]) - DateTime.From(DateTime.LocalNow()) else "")
Above result is in Duration data type. You can use some Duration functions to transform or format it.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
2 Replies
- BA_PeteSuper User
Hi Anonymous ,
My first guess would be that it is this part that is causing the problem:
DateTime.From([input_date]) - DateTime.From(DateTime.LocalNow)I think you would need to use a duration function around this for Power Query to recognise what you want to do, something like this:
Duration.Days(DateTime.From([input_date]) - DateTime.From(DateTime.LocalNow()))Pete
- v-jingzhangCommunity Support
Hi Anonymous
Your code just lacks a pair of parentheses after DateTime.LocalNow function. Every function should have a pair of parentheses at the end no matter there is any argument in it or not.
= Table.AddColumn(#"Changed Type", "Custom", each if [build]=1 and [r1_id]=null and [r2_id]=null and [r3_id] = null then DateTime.From([input_date]) - DateTime.From(DateTime.LocalNow()) else "")
Above result is in Duration data type. You can use some Duration functions to transform or format it.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.