cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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: 

replayyy_0-1594133649493.png

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Error calculating difference in days

@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.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: Error calculating difference in days

@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.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Highlighted
Frequent Visitor

Re: Error calculating difference in days

Thanks alot!

 

Solved is using = Duration.Days(Date.From(Duration.From(DateTime.LocalNow() - [DueDate]))

 

Atleast so it seems..

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors