Forum Discussion
Error calculating difference in days
Hi all,
I am trying to calculate the difference between a due date and the date of today. I looked around a bit and found this formula, which might have been able to help me : Duration.Days(Duration.From(DateTime.LocalNow() - [DueDate]))
Now I added this formula in a custom column and it gives an error:
Does anybody have an idea of what I am doing wrong? I want to calculate the difference between the duedate and the date of today.
Kevin
replayyy as the error suggest, your columns need to be date/time type to apply duration function and seem like one of the column is only date not date/time
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
2 Replies
- parry2kSuper User
replayyy as the error suggest, your columns need to be date/time type to apply duration function and seem like one of the column is only date not date/time
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- replayyyFrequent Visitor
Thanks alot!
Solved is using = Duration.Days(Date.From(Duration.From(DateTime.LocalNow() - [DueDate]))
Atleast so it seems..