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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
sonm10
Helper I
Helper I

Generating rows from date difference

Hello Experts, I have a event schedule as below

 

FromToDayStartEnd
1/1/20201/31/2020Mon7:00 AM3:00 PM
1/1/20201/31/2020Tue8:00 AM4:00 PM
1/1/20201/31/2020Wed9:00 AM5:00 PM
1/1/20201/31/2020Thu10:00 AM6:00 PM
1/1/20201/31/2020Fri11:00 AM7:00 PM
1/1/20201/31/2020Sat12:00 PM8:00 PM
1/1/20201/31/2020Sun1:00 PM9:00 PM

 

The schedule is maintained in periods and day. Now i want to expand that table to show the schedule for each date as below.

 

DateDayStartEnd
1/1/2020Wednesday9:00 AM5:00 PM
1/2/2020Thursday10:00 AM6:00 PM
1/3/2020Friday11:00 AM7:00 PM
1/4/2020Saturday12:00 PM8:00 PM
1/5/2020Sunday1:00 PM9:00 PM
1/6/2020Monday7:00 AM3:00 PM
1/7/2020Tuesday8:00 AM4:00 PM
1/8/2020Wednesday9:00 AM5:00 PM
1/9/2020Thursday10:00 AM6:00 PM
1/10/2020Friday11:00 AM7:00 PM
1/11/2020Saturday12:00 PM8:00 PM
1/12/2020Sunday1:00 PM9:00 PM
1/13/2020Monday7:00 AM3:00 PM
1/14/2020Tuesday8:00 AM4:00 PM
1/15/2020Wednesday9:00 AM5:00 PM
1/16/2020Thursday10:00 AM6:00 PM
1/17/2020Friday11:00 AM7:00 PM
1/18/2020Saturday12:00 PM8:00 PM
1/19/2020Sunday1:00 PM9:00 PM
1/20/2020Monday7:00 AM3:00 PM
1/21/2020Tuesday8:00 AM4:00 PM
1/22/2020Wednesday9:00 AM5:00 PM
1/23/2020Thursday10:00 AM6:00 PM
1/24/2020Friday11:00 AM7:00 PM
1/25/2020Saturday12:00 PM8:00 PM
1/26/2020Sunday1:00 PM9:00 PM
1/27/2020Monday7:00 AM3:00 PM
1/28/2020Tuesday8:00 AM4:00 PM
1/29/2020Wednesday9:00 AM5:00 PM
1/30/2020Thursday10:00 AM6:00 PM
1/31/2020Friday11:00 AM

7:00 PM

 

 

I have found that we can generate a date list with the Date.List function. In the function, we have to provide the starting date, the number of rows required and the increment number.

 

First I need to calculate the first date of a period corresponing to the given Day. In the above example, I first need the date of the first monday so I can use that as the start date for my list.

 

Additionally, I need the number of Days in a given period. In the above example, I have to find the number of mondays in the given period to find the number of rows to be created.

 

I am stuck with finding the first date for a day in a given period and finding the number of particular days in the period.

3 REPLIES 3
camargos88
Community Champion
Community Champion

Hi @sonm10 ,

 

Check this file:  Download PBIX 

 

Capture.PNG

 



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

Proud to be a Super User!



Thank you @camargos88 for the solution. However I am not able to get my time schedules (it only shows  date fields)when I expand the table. Can you explain the various step in your PBIX.

Hi @sonm10 ,

 

1) Create a table with your dates;

2) Create a column with the weekday name;

3) Merge the new and old table by the weekday name to get the times (start/end);

4) Expand the merged table;

 

Could you download the pbix ?

 

 



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

Proud to be a Super User!



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.