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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
victorh
Frequent Visitor

Days in a row Calculation

Hello everyone,

 

I have a specific case to solve and I need your help after a few hours of trying hard unsuccessfully.

 

Here is the context:

 

I have a Timesheet table which is structured as follows :

Each person puts the number of hours the days they are working OR on leave

 

IDLastnameDateNbHours
1Person A25/08/20228
1Person A26/08/20228
1Person A29/08/20228
2Person B22/08/20228
2Person B29/08/20228
3Person C26/08/20228
3Person C27/08/20228
3Person C28/08/20228
3Person C02/09/20228

 

And I have a "Leave Table" with the leaves for each person :

IDLastnameStart DateEnd Date
1Person A22/08/202226/08/2022
2Person B10/08/202214/08/2022
2Person B20/08/202201/09/2022
3Person C02/09/202205/09/2022

 

 

These tables are obviously simplified ones but this is the idea

The two tables are linked through the ID with a *-* relationship (impossible to do another way)

 

What I need is to list the people that have worked more than 7 days in a row, and show how many days in a row they have been working (if there are multiple periods with more than 7 days for a single person, show the max)

Thing to notice : the people put hours in the timesheet also for their leaves so we need to use the "Leave Table" to not count the dates between Start and End columns

 

In this example, no one works more than 7 days in a row of course but we should have :

IDLastnameMax days in a row
1Person A1
2Person B0
3Person C3

 

 

I hope this is clear enough for you to understand and I hope someone will be able to help me.

 

Thank you in advance !

2 REPLIES 2
amitchandak
Super User
Super User

@victorh , Both tables need to join with a common person table. The second table may or may not join with date table.It can choose one of the solutions. First, two expand data, the other two are based on measure

 

https://amitchandak.medium.com/dax-get-all-dates-between-the-start-and-end-date-8f3dac4ff90b
https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2

Measure way

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

https://amitchandak.medium.com/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-solutio...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello,

 

Thank you for your reply.

However, the tricky part of my request is to get the "days IN A ROW" which i have no idea how to get it.

The links you sent me don't answer this I believe.

 

Thank you,

Victor

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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