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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
vivi_nainai2021
Frequent Visitor

Calculating end date and duration for multiple tasks AND multiple projects

Hi PBI experts! I'm trying to calculate the end date and duration (between those two dates) for multiple projects that have multiple tasks within themselves. My table looks like: 

vivi_nainai2021_1-1656069546724.png

In the project name column, I have around 10 projects. All projects go through tasks and the start date of those tasks are in the start date column. First, what I need is to calculate the end date for each task for each project. So if project ARIDA went from gate 1 to gate 3, the end date of gate 1 would be the start date of gate 3 and so on. Second, I need to calcualte the duration in years between start date and end date for each task for each project, which would be easy if I can calculate the end date column. 

 

Does anyone have the solution? 

 

Cheers!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@vivi_nainai2021 , You can create a new column like

 

End date = Minx(filter(Table, [Project name] =earlier([Project name]) && [Start Date] > earlier([Start Date]) ), [Start Date])

 

Diff in days = datediff([Start date],[End Date], day)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @vivi_nainai2021 ,

 

Please try this formulas:

end date =
CALCULATE (
    MIN ( 'Table'[start date] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[project name] ),
        'Table'[start date] > EARLIER ( 'Table'[start date] )
    )
)

 

durations = DATEDIFF('Table'[start date],'Table'[end date],DAY)

 

vjaywmsft_0-1656494885380.png

 

Best Regards,

Jay

NickolajJessen
Solution Sage
Solution Sage

For a Measure solution feel free to check out the:
"Department increase from previous date" .Pbix here:
https://drive.google.com/drive/folders/1AjePk7NUXAloXHr42BEa2lDOr5dQr2Wg

amitchandak
Super User
Super User

@vivi_nainai2021 , You can create a new column like

 

End date = Minx(filter(Table, [Project name] =earlier([Project name]) && [Start Date] > earlier([Start Date]) ), [Start Date])

 

Diff in days = datediff([Start date],[End Date], day)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you @amitchandak , but I'm not getting the output I need. This is what I get but I need the start date of a succeeding task to the be end date for the previous one:

vivi_nainai2021_0-1656072196462.png

 

Can the previous formula be tweaked?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.