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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-stephen-msft
Community Support
Community Support

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
v-stephen-msft
Community Support
Community Support

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors