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
BobKoenen
Helper IV
Helper IV

Create a matrix with hours of employees based on active employement

Hi you all,

 

I have the following issue on which I could use some assistance. I would like to create a Matrix showing the number of hours an employee has worked based on the relavent employment at that time. 

 

My fact "hours table" looks like

 

NameHoursdate
Jane31-2-2020
Jane54-4-2020

 

I have a dim table "employee contracts"

 

NameContract beginContract endDepartmentteam
Jane1-1-202028-2-2020HRHR1
Jane1-3-2020 PayrolPayrol2

 

I Also have a separte date table. 

 

My output should be a matrix on a report page also containing a week and month slicer. If I would select the whole year the matrix should look like this

 

DepartmentTeamNameHours
HRHR1Jane3
PayrollPayrol2Jane5

 

If i would select april the matrix should look like:

DepartmentteamNameHours
PayrollPayroll2jane5

 

I would like to add that my "hours" table contains millions of rows so I do not want to add colomns to this fact table due to performance issues. So i am looking for the most effective way of solving this issue. 

 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @BobKoenen ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1609996475592.pngv-lionel-msft_1-1609996492533.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @BobKoenen ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1609996475592.pngv-lionel-msft_1-1609996492533.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@BobKoenen , You can have new columns like these in hours table

Department = maxx(filter(contracts,contracts[Strat Date] <=hours[date] && (isblank(contracts[end Date]) || isblank(contracts[end Date]) >=hours[date])),contracts[Department])


team = maxx(filter(contracts,contracts[Strat Date] <=hours[date] && (isblank(contracts[end Date]) || isblank(contracts[end Date]) >=hours[date])),contracts[team])

Thankx Amitchandak. But is going to add a column in a fact table not going to ruin my performance. It is a fact table of milions of rows on which i am going to ad another column

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.