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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Target
Helper I
Helper I

How to calculate the total employee count for each year based on Hiredate and terminationdate

In my data,i have hiredate and termination date columns,based on that i need to arrive the total employee count for each year

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Target ,

Thank you for @bhanu_gautam answer , and I have other suggestions for you:

Below is my Date table(indicate this customer activity time):

vxiandatmsft_0-1722929754340.png

Below is my hiredate and termination date table:

vxiandatmsft_1-1722929777278.png

You can create a new column to judge the customer whether work in company:

 

IsActive = 
VAR CurrentDate = 'Date'[Date]
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= CurrentDate &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= CurrentDate)
)
)

 

vxiandatmsft_2-1722929828896.png

And then you can create a measure to calculate the number of the customer:

ActiveEmployees = 
    CALCULATE(
        COUNTROWS('Table'),
        FILTER(
            'Table',
            'Table'[hiredate] <= MAX('Date'[Date]) &&
            (ISBLANK('Table'[termination date]) || 'Table'[termination date] >= MIN('Date'[Date]))
        )
    )

The final output will be like this:

vxiandatmsft_0-1722930014072.png

Best Regards,

Xianda Tang

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

5 REPLIES 5
Anonymous
Not applicable

Hi @Target ,

Thank you for @bhanu_gautam answer , and I have other suggestions for you:

Below is my Date table(indicate this customer activity time):

vxiandatmsft_0-1722929754340.png

Below is my hiredate and termination date table:

vxiandatmsft_1-1722929777278.png

You can create a new column to judge the customer whether work in company:

 

IsActive = 
VAR CurrentDate = 'Date'[Date]
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= CurrentDate &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= CurrentDate)
)
)

 

vxiandatmsft_2-1722929828896.png

And then you can create a measure to calculate the number of the customer:

ActiveEmployees = 
    CALCULATE(
        COUNTROWS('Table'),
        FILTER(
            'Table',
            'Table'[hiredate] <= MAX('Date'[Date]) &&
            (ISBLANK('Table'[termination date]) || 'Table'[termination date] >= MIN('Date'[Date]))
        )
    )

The final output will be like this:

vxiandatmsft_0-1722930014072.png

Best Regards,

Xianda Tang

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

Target
Helper I
Helper I

Hi,

 IsActive =
VAR CurrentDate = 'DateTable'[Date]
Here DateTable[Date] is derived from calendarAuto fuction?



Yes, it is a date table




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






bhanu_gautam
Super User
Super User

@Target ,Add calculated columns to determine if an employee was active in a given year. You can do this by creating a column in your date table that checks if the date falls between the hire date and termination date.

 

IsActive =
VAR CurrentDate = 'DateTable'[Date]
RETURN
CALCULATE(
COUNTROWS('YourTable'),
FILTER(
'YourTable',
'YourTable'[hiredate] <= CurrentDate &&
(ISBLANK('YourTable'[terminationdate]) || 'YourTable'[terminationdate] >= CurrentDate)
)
)

 

 

Than create a measure for active employee

ActiveEmployees =
    CALCULATE(
        COUNTROWS('YourTable'),
        FILTER(
            'YourTable',
            'YourTable'[hiredate] <= MAX('DateTable'[Date]) &&
            (ISBLANK('YourTable'[terminationdate]) || 'YourTable'[terminationdate] >= MIN('DateTable'[Date]))
        )
    )



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Target_0-1722579397235.png

It shows error

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors