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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Hesham121
Regular Visitor

Prepare Staff Roster Data for PowerBI Analysis

Hello,

 

I've Staff Roster as shown in the below screenshot and I need to build a data model to analyze the data to get for example, how many employees was doing "R" in specific date... 

 

Noting that I'll update the Rosters per month by adding employees' activities per day with the same below format

Hesham121_0-1693425717384.png

 

I've built some data models as below, but it doesn't give me the expected results

 

Hesham121_1-1693425980505.png

 

1 ACCEPTED SOLUTION
JoeBarry
Solution Sage
Solution Sage

HI @Hesham121 

 

In Power Query, highlight the Emps Table. Then highlight the Date columns, right click and the unpivot these columns. You will then have two new columns, Attribute and Value. Rename Attribute to Working Date and Value to Task. This will give you a table format that Power BI can work properly with.

 

Can i ask why the Public Holiday table is seperate to the Date? If there are no duplicate dates in the table, in Power query merge it with the Date table on the date and expand to show the Holiday name. 

 

To count how many people where doing a certain task, please try the following

 

Tasks Amount = COUNT(Emps[Task])

 

Here in a Tbale or Matrix visual you could add the Task, Employee name & Date to the table and then this measure and you will get the reults needed.

 

if you want a calculation for a particular Task or Tasks you can do the following

 

R tasks = CALCULATE([Task Amount], KEEPFILTERS(Emps[Task] = "R"))

 

R-D-N Tasks = CALCULATE([Total Task] in {"R", "D", "N"}))

 

Thanks

Joe

 

If this post helps, then please Accept it as the solution

View solution in original post

2 REPLIES 2
Hesham121
Regular Visitor

Thank you so much for the detailed solution, I'm new to PowerBI and it was clear for me!

JoeBarry
Solution Sage
Solution Sage

HI @Hesham121 

 

In Power Query, highlight the Emps Table. Then highlight the Date columns, right click and the unpivot these columns. You will then have two new columns, Attribute and Value. Rename Attribute to Working Date and Value to Task. This will give you a table format that Power BI can work properly with.

 

Can i ask why the Public Holiday table is seperate to the Date? If there are no duplicate dates in the table, in Power query merge it with the Date table on the date and expand to show the Holiday name. 

 

To count how many people where doing a certain task, please try the following

 

Tasks Amount = COUNT(Emps[Task])

 

Here in a Tbale or Matrix visual you could add the Task, Employee name & Date to the table and then this measure and you will get the reults needed.

 

if you want a calculation for a particular Task or Tasks you can do the following

 

R tasks = CALCULATE([Task Amount], KEEPFILTERS(Emps[Task] = "R"))

 

R-D-N Tasks = CALCULATE([Total Task] in {"R", "D", "N"}))

 

Thanks

Joe

 

If this post helps, then please Accept it as the solution

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.