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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
MarkHughes
Regular Visitor

Calculating over 30 , 60 and 90 days and output to column

Hello,

 

Data Source: SharePoint Online list

Developing in: PowerBI Desktop

 

I have a query about a query that I'm hoping some kind member of the community can help me with,

 

Issue

I need to have 3 count panels on my report to show a count of items that are overdue for 30, 60 & 90 days. The Column name is "Date Due" and I also have an "Overdue" column. I need assistance creating a calculation to look at the "Date Due" column and if it's 30, 60 or 90 days have passed from todays date, it must input either 30, 60 or 90 into the Overdue column based on the result.

 

Much appreciated

1 ACCEPTED SOLUTION

I assumed the [Due Date] is of type Date, while it's actually DateTime
this should work

if Duration.Days(DateTime.LocalNow() - [Date Due])>=90 then 90 else 
if Duration.Days(DateTime.LocalNow() - [Date Due])>=60 then 60 else 
if Duration.Days(DateTime.LocalNow() - [Date Due])>=30 then 30 else 
0

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

5 REPLIES 5
Stachu
Community Champion
Community Champion

in PowerQuery you need to add new column with following syntax:

if Duration.Days(Date.From(DateTime.LocalNow()) - [Date Due])>=90 then 90 else 
if Duration.Days(Date.From(DateTime.LocalNow()) - [Date Due])>=60 then 60 else 
if Duration.Days(Date.From(DateTime.LocalNow()) - [Date Due])>=30 then 30 else 
0


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thank you for the reply.

 

I've just tried to create a custom column called "Overdue Days" and then apply that but it's giving me an error.

 

Please see below. Any suggestions?

 

synt1.PNGreporting1.PNG

I assumed the [Due Date] is of type Date, while it's actually DateTime
this should work

if Duration.Days(DateTime.LocalNow() - [Date Due])>=90 then 90 else 
if Duration.Days(DateTime.LocalNow() - [Date Due])>=60 then 60 else 
if Duration.Days(DateTime.LocalNow() - [Date Due])>=30 then 30 else 
0

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

This worked perfectly, thank you

MarkHughes
Regular Visitor

Hello,

 

Data Source: SharePoint Online list

Developing in: PowerBI Desktop

 

I have a query about a query that I'm hoping some kind member of the community can help me with,

 

Issue

I need to have 3 count panels on my report to show a count of items that are overdue for 30, 60 & 90 days. The Column name is "Date Due" and I also have an "Overdue" column. I need assistance creating a calculation to look at the "Date Due" column and if it's 30, 60 or 90 days have passed from todays date, it must input either 30, 60 or 90 into the Overdue column based on the result.

 

Much appreciated

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors