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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
nailed
Frequent Visitor

Calculate active headcount and filtered with probation period

Hi, master

 

Could you help me how to count an active headcount with filtered probation period?

 

I have a table with employee details and a table with employee status month by month also a date table

Here is the current measure :

 

Headcount =
CALCULATE(COUNTX(FILTER('Employees','Employees'[Join Date]<=MAX('dDates'[Date]) && ISBLANK('Employees'[Resign Date]) || 'Employees'[Resign Date]>MAX('dDates'[Date])),'Employees'[Emp ID]))+0
 
Emp_IdMonthStatus
1002801/01/2021

Probation

1002801/02/2021Permanent
1002801/03/2021Permanent
1002801/04/2021 
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @nailed 

 

You can try a measure like below to count distinct employee IDs from Employee Status table and put Status column into a slicer or filter pane to filter by.

Headcount =
CALCULATE (
    DISTINCTCOUNT ( 'employee status'[Emp ID] ),
    FILTER (
        'Employees',
        'Employees'[Join Date] <= MAX ( 'dDates'[Date] )
            && (
                ISBLANK ( 'Employees'[Resign Date] )
                    || 'Employees'[Resign Date] > MAX ( 'dDates'[Date] )
            )
    )
) + 0

 

Or if you want to filter it directly in the measure, you can try 

Headcount =
CALCULATE (
    DISTINCTCOUNT ( 'employee status'[Emp ID] ),
    FILTER (
        'Employees',
        'Employees'[Join Date] <= MAX ( 'dDates'[Date] )
            && (
                ISBLANK ( 'Employees'[Resign Date] )
                    || 'Employees'[Resign Date] > MAX ( 'dDates'[Date] )
            )
    ),
    'employee status'[Status] = "Probation"
) + 0

 

Note that the Employees table should be able to filter 'Employee Status' table by connecting them on Emp ID columns. 

 

If this doesn't work, please share some sample data and expected result that we can use to test on and check the result.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @nailed 

 

You can try a measure like below to count distinct employee IDs from Employee Status table and put Status column into a slicer or filter pane to filter by.

Headcount =
CALCULATE (
    DISTINCTCOUNT ( 'employee status'[Emp ID] ),
    FILTER (
        'Employees',
        'Employees'[Join Date] <= MAX ( 'dDates'[Date] )
            && (
                ISBLANK ( 'Employees'[Resign Date] )
                    || 'Employees'[Resign Date] > MAX ( 'dDates'[Date] )
            )
    )
) + 0

 

Or if you want to filter it directly in the measure, you can try 

Headcount =
CALCULATE (
    DISTINCTCOUNT ( 'employee status'[Emp ID] ),
    FILTER (
        'Employees',
        'Employees'[Join Date] <= MAX ( 'dDates'[Date] )
            && (
                ISBLANK ( 'Employees'[Resign Date] )
                    || 'Employees'[Resign Date] > MAX ( 'dDates'[Date] )
            )
    ),
    'employee status'[Status] = "Probation"
) + 0

 

Note that the Employees table should be able to filter 'Employee Status' table by connecting them on Emp ID columns. 

 

If this doesn't work, please share some sample data and expected result that we can use to test on and check the result.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

visheshjain
Impactful Individual
Impactful Individual

Hi @nailed ,

 

Please correct me if I have understood the problem wrong.

 

Create a relationship using the emp_id column between employee details and employee tables and then write a measure using the COUNTROWS() function on your fact table, with the filters of 'Active' from the Dim table (employee details table) and Probation status from the fact table(employee table).

 

I am unable to understand why do you have date filters in your measure. You can simply create a realtionship between your calendar/date table and your fact table and then put the date/year month as a slicer or as a column in your table/matrix visual.

 

Hope this helps.

P.S. - Performance wise COUNTROWS() is better than COUNT().

 

Thank you,

 

Vishesh Jain

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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