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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
northshorehiker
New Member

Count based on date compared to two fields in another table

I have a table containing a list of "week ending" dates. I have another table of employees, including their hire and termination dates. I'd really like to add a calculated column to the table of dates that counts the number of active employees as of that date, so it would be a count of the rows in the employee table where the employee hire date is prior to the "week ending" date and the termination date is after the "week ending" date.

 

Does that make sense? Any assistance is most appreciated.

==

Chris

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Something like this?

 

No of Employees =
CALCULATE (
    COUNT ( employee[employee] ),
    FILTER (
        employee,
        AND (
            employee[hire date] <= 'week ending'[week ending],
            employee[termination date] > 'week ending'[week ending]
        )
    )
)

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

2 REPLIES 2
mwegener
Most Valuable Professional
Most Valuable Professional

Something like this?

 

No of Employees =
CALCULATE (
    COUNT ( employee[employee] ),
    FILTER (
        employee,
        AND (
            employee[hire date] <= 'week ending'[week ending],
            employee[termination date] > 'week ending'[week ending]
        )
    )
)

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Thank you so much for answering my noob question. That's exactly what I was after.

==

Chris

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.