Forum Discussion

Egemeny's avatar
Egemeny
Frequent Visitor
6 years ago

Calculated Column for New Employee

Hi everyone,

 

I would like to create a reporting that shows new employees per month. For that I would like to have a calculated column that works out the 'New Employee' value and returns as '1' if the same employee number doesn not exist in the prior period.

 

Example: 1525 and 1526 return as '1' for 01/12/2019 as these employee code did not exist for 01/11/2019.

 

My challenge is,  mydataset has seperate calender table and employee data table and following DAX did not work.

I believe i need to create a connection.

 

New Employee =
VAR temp =
    FILTER (
        Table1,
        Table1[Employee Number] = EARLIER ( Table1[Employee Number] )
            && Table1[Period] < EARLIER ( Table1[Period] )
    )
RETURN
    IF ( COUNTROWS ( temp ) > 0, 0, 1 )

 

Your help really appreaciated and you can see the example pbix file here.

 

Thanks!

2 Replies

  • Thim's avatar
    Thim
    Resolver V

    Just to make sure I understand the result you want.

     

    If an emploee starts on the 02/11-2019, then they should be regarded as new for December 2019?

    What if they start on the 31/11-2019?

     

    Thank you in advance. 🙂

    • Egemeny's avatar
      Egemeny
      Frequent Visitor

      Hey Thim ,

      thank you for your response and good question. 🙂

       

      The result that i would like to see is all employees started a calender month before can be return as 1. 🙂

       

      I hope it's clearer and thank you in advance.