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
Kerma
Frequent Visitor

Visualizing workshifts starting and ending on different day in day-hour table

Hello!

 

I'm interested in showing in a table visualization the amount of workers working each hour of the day. I succesfully managed to map the shifts that happen within the same day with hours as rows and days as columns. I ran into into problems when trying to show shifts that spread over two or more days. 

 

The way I'm visualizing is as follows

 

 MondayTuesdayWednesday
06-07 2 
07-08131
08-092  
09-1011 

 

and the sample data whch I haven't managed to visualized could be as follows

 

StartdateStarttimeEnddateEndtime
3.7.201722:006.7.20176:00
30.6.20178:0030.6.201714:00
30.6.201718:002.7.20172:00
29.6.201710:0030.6.201712:00
29.6.201720:003.7.201715:00

 

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Hi @Kerma,

 

You can refer to below sample to get hour - weekday analysis visual:

 

Sample:

1. Add custom columns to convert columns to datetime.

4.PNG

 

2. Add custom column to get datetime records between 'start datetime' and 'end datetime'.

#"Added Custom1"= Table.AddColumn(#"Changed Type1", "Datetime List", each List.DateTimes([Start Datetime],Duration.TotalHours(Duration.From([End Datetime]-[Start Datetime])), #duration(0, 1, 0, 0)))

5.PNG

 

 

3. Keep related columns and expand these records.

6.PNG7.PNG

 

4. Save and return to report view.

5. Add calculated columns to show weekday and hour.

HOUR = HOUR([Datetime List])

WeekDay = FORMAT([Datetime List],"dddd") 

 

5. Create matrix visual with above calculate columns.

8.PNG

6. Add a table preview visual as the slicer.

9.PNG

 

After above steps, you can use table preview visual to choose the analysed records.

10.PNG

 

Notice: I also upload this sample file as the attachments.

 

Regards,

XXiaoxinSheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
KarineLago
Advocate I
Advocate I

@Kermayou could merge the date and hour column to obtain one type of start date and end date. After that, you can use:

 

DATEDIFF(<start_date>, <end_date>, <interval>)

 

Imagem 4 2017-07-03 09h06min.png

From Brazil? Go to IntelExcel YT channel https://www.youtube.com/user/Intelxcel to learn Power BI.

I need to map the results in a day-hour visualization shown above. For example a shift from 3.7.2017 20:00 to 5.7.2017 08:00 would show 1 for each hour on 3.7.2017 after 20:00, 1 for each hour of 4.7.2017 and 1 for hours 00-08 on 5.7.2017.

Hi @Kerma,

 

You can refer to below sample to get hour - weekday analysis visual:

 

Sample:

1. Add custom columns to convert columns to datetime.

4.PNG

 

2. Add custom column to get datetime records between 'start datetime' and 'end datetime'.

#"Added Custom1"= Table.AddColumn(#"Changed Type1", "Datetime List", each List.DateTimes([Start Datetime],Duration.TotalHours(Duration.From([End Datetime]-[Start Datetime])), #duration(0, 1, 0, 0)))

5.PNG

 

 

3. Keep related columns and expand these records.

6.PNG7.PNG

 

4. Save and return to report view.

5. Add calculated columns to show weekday and hour.

HOUR = HOUR([Datetime List])

WeekDay = FORMAT([Datetime List],"dddd") 

 

5. Create matrix visual with above calculate columns.

8.PNG

6. Add a table preview visual as the slicer.

9.PNG

 

After above steps, you can use table preview visual to choose the analysed records.

10.PNG

 

Notice: I also upload this sample file as the attachments.

 

Regards,

XXiaoxinSheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

This looks very good, I will try this out! Thanks a lot 🙂

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.