cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
diederd Regular Visitor
Regular Visitor

Employee turnover/total headcount

Hello.

 

 

I have recently received a request in which our HR Dept would like to have a report displaying the following:

 

- total employees/head count for a date period (broken down by year)

- noting that an employee could have been employed in Role A and during the year promoted to a new Role B

 

I have attached a screenshot of the data structure I've been provided; hoping someone could point me in the right direction as to how to go about starting this DAX query?

 

screenshot.png

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Employee turnover/total headcount

Hi @diederd ,

 

We can create a measure using following formula to meet your requirement:

 

HeadCount = 
COUNTROWS (
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                'Table',
                OR (
                    AND (
                        'Table'[End Date] >= MAX ( 'calendar'[Date] ),
                        'Table'[Start Date] <= MIN ( 'calendar'[Date] )
                    ),
                    AND ( ISBLANK ( 'Table'[End Date] ), [Start Date] <= MIN ( 'calendar'[Date] ) )
                )
            ),
            "Name", [Name]
        )
    )
)

14.PNG

 

If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
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

3 REPLIES 3
Super User III
Super User III

Re: Employee turnover/total headcount

Hi @diederd ,

 

not easy to figure out what you want to do, from you requirement description and you data structure.

 

-noting that an employee could have been employed in Role A and during the year promoted to a new Role B

How should this be handled when looking at period where an employee has changed role? Should the employee be part of the head count for each role in that period, or only the last? Or the only the first?.

 

From your screenshot of the data structure, there is no employee-id. If I can assume that each row is a distinct employee, then the only option would be to use the COUNTROWS-function. But then it would not be possible to detect if an employee has changed e.g. team or work location, only to do the head count pr group. 

 

You mention Roles, but there are no Roles-column in your data structure.

Cheers,
Sturla

Community Support Team
Community Support Team

Re: Employee turnover/total headcount

Hi @diederd ,

 

We can create a measure using following formula to meet your requirement:

 

HeadCount = 
COUNTROWS (
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                'Table',
                OR (
                    AND (
                        'Table'[End Date] >= MAX ( 'calendar'[Date] ),
                        'Table'[Start Date] <= MIN ( 'calendar'[Date] )
                    ),
                    AND ( ISBLANK ( 'Table'[End Date] ), [Start Date] <= MIN ( 'calendar'[Date] ) )
                )
            ),
            "Name", [Name]
        )
    )
)

14.PNG

 

If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 


BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
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

diederd Regular Visitor
Regular Visitor

Re: Employee turnover/total headcount

v-lid-msft.

 

Thank you so much for your prompt response/answer.

 

This is simply genius!! Perfect in the way in which it answers the question raised by our HR team and get's me out of a tight spot 😉 Thank you again for your help in providing the solution.

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors