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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
DJTentman
Frequent Visitor

Calculate employees available per day

I want to create a table with how many employees are available to work each day. I have a table with all the dates:

 

Calendar Relative = CALENDAR( TODAY()-3650, TODAY()+3650 )

 

I have another table with all employees listed as well as their starting date and ending date (10 years in the future if they are employed ongoing)

 

I have a column with the following DAX, but I know this isn't quite what I need.

 

Available Employees =
CALCULATE (
    COUNT('Employees'[First Name]),
    'Employees'[Start Date] < 'Calendar Relative'[Date] || 'Employees'[Last Day Filled] > 'Calendar Relative'[Date]
 
Can anyone help me accomplish this. I'm not very skilled with DAX.

 

 

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @DJTentman 

 

You can try the following methods.
Sample data:

vzhangti_0-1670825559046.png

Measure = 
CALCULATE ( COUNT ( 'Table'[Employee ID] ),
    FILTER ( ALL ( 'Table' ),
        [Start Date] <= SELECTEDVALUE ( 'Date'[Date] )
            && [End Date] >= SELECTEDVALUE ( 'Date'[Date] ) ) )
    + CALCULATE ( COUNT ( 'Table'[Employee ID] ),
        FILTER ( ALL ( 'Table' ),
            [Start Date] <= SELECTEDVALUE ( 'Date'[Date] )
                && [End Date] = BLANK () ) )

vzhangti_1-1670825671624.png

Hope this method helps you.

 

Best Regards,

Community Support Team _Charlotte

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

This makes a lot of sense. Thanks. I ended up with this formula:

 

Available =
CALCULATE ( COUNT ( 'Employees'[ID] ),
    FILTER ( ALL ( 'Employees' ),
        [Start Date] <= SELECTEDVALUE ( 'Calendar Relative'[Date] )
            && [Last Day Filled] >= SELECTEDVALUE ( 'Calendar Relative'[Date] ) ) )
 
I don't need to worry about blank quit dates because it automatically fills in a date 10 years in the future if it is blank.
 
However, I come up with blank values for every day with this formula. What am I doing wrong?
amitchandak
Super User
Super User

@DJTentman , refer to the blog or attached files

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

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

Thanks, that's been helpful. So, I'm trying to create the number of employee/days per week for each date in the list. This is the DAX I'm using:

 

Available Employees =
CALCULATE (
    SUM('Employees'[Days per week]),
    FILter(Employees,'Employees'[Start Date] < [Date] || 'Employees'[Last Day Filled] > [Date]
))
 
However, this creates a count that is the same for every day. I'm not quite sure why.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.