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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Sisyfos-XY
New Member

Using relationships in temporary table that calculates workers per hour based on actual hours table.

I have data that has StartHour and EndHour for each employee in my organization for every time they have come to work and left. From that I want to create a hourly manning schedule. To do that I followed the instructions here:

https://community.powerbi.com/t5/Desktop/Counting-numbers-per-hour-between-a-start-and-end-time/td-p...

 

And I have a temporary table and a formula that counts the workers per hour data:

WorkerPerHour = CALCULATE(COUNTROWS('Actual_Hours'), FILTER(ALL('Actual_Hours'), 'Actual_Hours'[StartHour] <= Worker_per_hour_temp[Value] && 'Actual_Hours'[EndHour] >= Worker_per_hour_temp[Value]))
 
That "Value" in here is just a list of hours (integers) from 0 to 30 (I have moved the hours past midnight to continue the hours so that comparison above works, but that is a separate problem). The StartHour and EndHour are just integer values. 
 
This all seems to create correct values. My problem is this though: how can I make this data follow my filters? It has no relation to the original datatable it seems and does not follow date filters, location filters etc. It just pulls all the hours for every day in the data and summarizes those. Do I need to add columns but how? I tried to bring in the location column, but that did not seem to work. It would also feel weird to bring here all different possible slicers instead of connecting this to the data model itself properly so perhaps I need to do something with the "Manage relationships", but when I tried that it did not seem to work either. I am propably missing something really simple here in the original formula that was used to do the calculaterows pars, but as I am rather new with Power BI, I am not able to figure it out it seems.
 
Any help would be appreciated.
2 REPLIES 2
amitchandak
Super User
Super User

@Sisyfos-XY ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi, 

Thanks! I can prepare those examples, but it will have to be next week. Burning midnight oil now preparing for a deadline and I have to be pretty careful to make sure everything is properly anonymized as the data contains personal information and as I said I am not that familiar with Power BI and might miss something. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.