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! Request now

Reply
mhq_
Regular Visitor

Use Power query to dynamically forecast days used per month on tasks based on startdate and duration

Hello,

 

I am fairly new to M code and have the need to dynamically forecast employee resourcing per month, based on start date and duration of tasks (See below Table).

 

For each row, I would like to translate the start date of tasks and duration (Days spent working on it) and dynamically forecast the days per month that would be used for it.  For example: 

 

       Index 0 starts working on a task from 5/11/2021 for 50 days, therefore in Column 1/11/2021 he would spend x days (days in month remaining from start date and checked against duration) working on it and this value gets input in Index 0 row for Column 1/11/2021 and if the days of the month 1/11/2021 run out and there are still days which are left in duration, then the remaining are assigned to the next month 1/12/2021 and so on and so forth, until the duration is completely forecasted for each month from start date.

 

I know I can do this in excel using normal excel formuals but I have a need to do this on power query and since I am very new to M code, I am struggling to develop a logic that enables me to perform this task. I would really appreciate some help with this.

 

 

mhq__0-1631584033399.png

 

Thank you!

 

 

1 REPLY 1
lbendlin
Super User
Super User

Power Query is a lot of things, but dynamic is not one of them.  For what you seem to be trying to achieve Excel formulas seem to be a better fit.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.