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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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