Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ganchevd
Helper I
Helper I

Calculate days overdue in Edit Query mode MS Power BI

Hello All,

 

I have the following issue. I try to insert a custom column i Edit Query mode ow my report where to calculate the days overdue according to today. I tried the following: DateTime.Date(DateTime.LocalNow())-[Due Date], but then the result was 24 days. This is not my mission, because I have overdues from 1st August 2016, which I get as 24 day overdue and it is not correct. What formula should I use. It is easy for me to do it in query mode with DATEDIFF but this is not what I want.

 

Thank you all in advance.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @ganchevd,

You can use Duration functions, please use the following M formula, which will give you the "Datediff" in days. But you can also have other datepart types as well.

=Duration.Days(Duration.From(DateTime.LocalNow()-[Date]))

1.PNG

Please see the expected result using my sample table date.

2.PNG

Best Regards,
Angelia

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This literally didn't work.

v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @ganchevd,

You can use Duration functions, please use the following M formula, which will give you the "Datediff" in days. But you can also have other datepart types as well.

=Duration.Days(Duration.From(DateTime.LocalNow()-[Date]))

1.PNG

Please see the expected result using my sample table date.

2.PNG

Best Regards,
Angelia

Works perfectly! Thank you

fhill
Resident Rockstar
Resident Rockstar

Please post some sample data so we can assist in more detail.  Thank You




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors