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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AquaLyzer
New Member

Spilt Calculated Duration with Overlapping Dates for Same Record - Power Query

Hello,

I've spent quite some time trying to resolve an issue related to calculating "Out of Compliance Days" for a dataset, and I could really use some help. I've searched through the forum, but so far, I haven't found a solution that fits my specific scenario.

 

I'm working with a dataset similar to the tables below: students are required to submit their projects within 10 days. However, complications arise when students go on sick leaves, leading to the creation of duplicate records for the same student and project. When a student is on sick leave, the system generates a resolution date, set to 5 days after the last sick day.

 

Please note that whether a student is on sick leave or not, "Out of Compliance Days" should still be calculated based on the days between the project due date and the submission date.

 

The standard calculation of the duration between "Submission Date" and "Project Due Date," falls short when there are multiple exceptions, as shown in the example for Project ID 532:

Student NameProject IDProject Due DateSick Start DateSick End DateResolution dateSubmission DateOut Of Compliance Days
Student 175326/11/20236/2/20236/8/20236/13/20236/16/20235
Student 175326/11/20236/9/20236/15/20236/20/20236/16/20235
Student 104894/2/20234/26/20234/27/20235/2/20234/28/202326
Student 036014/27/20234/28/20234/28/20235/3/20234/29/20232
Student 083983/30/20234/22/20234/24/20234/29/20234/24/202325


I'm looking to add a column that calculates and splits the "Out of Compliance Days" by exception for the same project ID. I expect the results to reflect this:

Student NameProject IDProject Due DateSick Start DateSick End DateResolution dateSubmission DateOut Of Compliance Days
Student 175326/11/20236/2/20236/8/20236/13/20236/16/20232
Student 175326/11/20236/9/20236/15/20236/20/20236/16/20233
Student 104894/2/20234/26/20234/27/20235/2/20234/28/202326
Student 036014/27/20234/28/20234/28/20235/3/20234/29/20232
Student 083983/30/20234/22/20234/24/20234/29/20234/24/202325

 

I'm at a loss as to how to achieve this, and I would greatly appreciate any help, tips, or guidance. Thanks in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AquaLyzer ,

 

Here's the result:

vstephenmsft_0-1697532587948.png

 

You can check mroe details from my attachment.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @AquaLyzer ,

 

Here's the result:

vstephenmsft_0-1697532587948.png

 

You can check mroe details from my attachment.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

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.