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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Saad_Hanif456
Helper I
Helper I

New Joiners Count

Dear Experts,

Need to calculate how many employees joined each month but the trick is in the following table example: (Remarks column is given for help)

S.NoPayroll MonthCodeName CNIC Hiring DateRemarks
11-Jan-2410438Imtiaz455558877711-Jan-24Hired
21-Jan-2410320Safdar455558877721-Feb-23 
31-Jan-2410553Ali 455558877731-Oct-23 
41-Jan-2410042Hussain455558877741-Jan-24HIred
51-Feb-2410438Imtiaz455558877711-Jan-24 
61-Feb-2410320Safdar455558877721-Feb-23 
71-Feb-2410553Ali 455558877731-Oct-23 
81-Feb-2410042Hussain455558877741-Jan-24 
91-Feb-2410953Waseem455558877761-Feb-24Hired
101-Feb-2410993khurram455558877771-Feb-24hired
111-Mar-2410555Imtiaz455558877711-Mar-24Confirmed with new Emp ID, CNIC is same
121-Mar-2410556Hussain455558877741-Mar-24Confirmed with new Emp ID, CNIC is same
131-Mar-2410399Arbaas455558877751-Feb-24 
141-Mar-2410993khurram455558877771-Feb-24 
151-Mar-2410959maheen455558877801-Mar-24Hired
161-Apr-2410555Imtiaz455558877711-Mar-24 
171-Apr-2410556Hussain455558877741-Mar-24 
181-Apr-2410959maheen455558877801-Mar-24 
191-Apr-2410541Idrees4555588778125-Mar-24He was hired in March 2024 but was included in April 2024 payroll. I want him to be counted in the month of March 2024 only as per hiring date
201-Apr-2410557Waseem455558877761-Apr-24Confirmed with new Emp ID
211-Apr-2410558khurram455558877771-Apr-24Confirmed with new Emp ID

 

1- Imtiaz and safdar joined in Jan 2024 and confirmed in Mar 2024 with a new emp ID, CNIC is the same. I do not want to count them in March 2024 because they were already counted in Jan 2024. (That i have already done with DAX with the following)

Step 1: Add a calculated column to determine the first hiring date for each CNIC:

firsthiringdate =

CALCULATE(

    MIN(Payroll[Hiring Date]),

    ALLEXCEPT(Payroll,Payroll[CNIC]))



Step 2: Create a measure to count the number of unique employees who joined in each month based on this first hiring date

VAR CurrentMonth = SELECTEDVALUE(Payroll[Payroll Month])

RETURN

CALCULATE(

    DISTINCTCOUNT(Payroll[CNIC]),

    FILTER(

        Payroll,

        Payroll[firsthiringdate] >= EOMONTH(CurrentMonth, -1) +1 &&

        Payroll[firsthiringdate] <= EOMONTH(CurrentMonth,1)))

MonthsResult
Jan 2
Feb2
Mar1
Apr0

2 - However, Mr. idrees who was joined in March 2024 is not being counted since he has been added in the Payroll of April 2024
I want his count reflects in the month of March 2024 but the with aforemention DAX he is not refelecting in March 2024 neither in April 2024
MonthsResultRequired 
Jan 22
Feb22
Mar12
Apr00

Please help in this regards and suggest the DAX where my both 1 and 2  condition gets fulfilled so that i can move forward quickly.
PBX FIle is enclosed for working (https://drive.google.com/file/d/1N7qHOwNoO9nsP_bkmLxt4keIBanrcxAA/view?usp=sharing )

Regards
Saad Hanif

1 ACCEPTED SOLUTION

Dear @Rupak_bi,

I wanted the result same as in the following table visual:

Note: Have the silcer of calendar[month], calender[year] and department [name] on the canvas

Month Name Hire
JanImtiaz 1
JanHussain1
Feb Waseem1
Feb Khurram1
Feb Arbaas1
MarMaheen1
MarIdress1

 

Regards,

Saad Hanif

View solution in original post

5 REPLIES 5
Rupak_bi
Post Prodigy
Post Prodigy

Hi I think below will be your expected out based on data. Feb count will be 3 , Khurram, Arbaas, Waseem

Rupak_bi_0-1717749723486.png

Rupak_bi_1-1717749785702.png

 

 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Dear @Rupak_bi,

I wanted the result same as in the following table visual:

Note: Have the silcer of calendar[month], calender[year] and department [name] on the canvas

Month Name Hire
JanImtiaz 1
JanHussain1
Feb Waseem1
Feb Khurram1
Feb Arbaas1
MarMaheen1
MarIdress1

 

Regards,

Saad Hanif

Dear @Rupak_bi ,

 

Thank you so much

Hi , Thanks for your reply. Please accept my last reply as solution so that other fellow can refer.


Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

just update the table relationship to "firsthiredate"

Rupak_bi_0-1717761130945.png

Rupak_bi_1-1717761161050.png

If this solves your problem, Plz accept it as solution.

 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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