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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
htsvhwave
Helper II
Helper II

How to create Start Date and End Date columns from one Date Column in a new tabel

need to make the start date and end date columns from the date column, in a new tabel. I have a table of employees and the dates on which they are absent because of sickness but I need to reduce the table so that there is no separate row for each date if that date is part of a absent period that lasts more than one day.  furthermore i need it to also make a column where is sums up the hours they were absent in that period.

Example Input: 

Name    Date        Type of absence   Hours
Ivana   15/06/2023  Sick              8
Ivana   16/06/2023  Sick              8
Ivana   17/06/2023  Sick              4
Ivana   18/06/2023  Sick              8
Ivana   19/06/2023  Sick              8
Ivana 20/06/2023 Sick 8 Ivana 05/01/2023 Sick - Doctor 2 Ivana 20/05/2023 Sick 8 Ivana 21/05/2023   Sick 5

 Expected Output:

Name    Start Date  EndDate     Hours
Ivana   15/06/2023  20/06/2023   36
Ivana   05/01/2023  05/01/2023   2
Ivana   20/05/2023  21/05/2023   13

 

1 ACCEPTED SOLUTION

@htsvhwave 

pls see the attahment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

10 REPLIES 10
ryan_mayu
Super User
Super User

@htsvhwave 

why the first row is not 44?

2.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hello, i tried your approach however it splits up the period because of the weekend, how can i fix this?

htsvhwave_0-1688120647014.png

 

To be more specifik, i want the weekend included in the period. Lets say:

Name    Date        Type of absence   Hours
Ivana   15/06/2023  Sick              8
Ivana   16/06/2023  Sick              8
Ivana   19/06/2023  Sick              8
Ivana 20/06/2023 Sick 8

I want to see this

 

Name    Start Date  EndDate     Hours
Ivana   15/06/2023  20/06/2023   32

@htsvhwave 

pls see the attahment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you so much, it seem to work for weekend however how can i also make it consider public holidays in the dax code. I have a date table where i distiguise between weekdays, weekends and holidays

then you can combine calendar table and holiday table ,then to update the result





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hello @ryan_mayu , i have made a sample file, would you be able to help in how i can considere the holidays in the dax formula

https://drive.google.com/file/d/1255SoUAgTZfRbtww6K3h2uSe3QRPBm65/view?usp=drive_link

@htsvhwave 

I can't open the google drive, i updated your sample file, pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




i have a seperate data table currently where i have the holidays

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors