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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Saad_Hanif456
Helper I
Helper I

New Hires Count

Dear Experts,

 

I need to calculate the count New Hires month wise as per following condition through DAX Calculation which is also mentioned in the sample Working Sheet.

 

1. There are two Employees Mr. Imtiaz and Mr. Hussain who have joined in Jan 01, 2023 but upon confirmation we generate New Code and new Date of Joining of the same month that is April 01, 2023. Their Date of Joining should be counted on Jan 01, 2023. We can calculate the count through CNIC column as well since the CNIC number is the same.

 

2. I have slicer of Calendar [ Year ] and Calendar [ Month ].

 

Link of the files mentioned below for reference.

https://drive.google.com/file/d/1f2A6KLuCjnq05UxS0xB8Li7XD-E9SqgG/view?usp=sharing

 

Result Required
MonthsNew joiners
Jan2
Feb3
Mar2
Apr3


Regards,

Saad Hanif

 

2 ACCEPTED SOLUTIONS
VillyMBI
Resolver I
Resolver I

Hello @Saad_Hanif456 ,

You have not specified anything about relationship between 'Calendar' and 'Payroll' table.
Considering you have an active relationship with 'Hiring date'
Head Count =DISTINCTCOUNT([CNIC ])


If not, considering you have an active relationship with 'Payroll Month' and a inactive relationship with 'Hiring date'

Head Count = CALCULATE(DISTINCTCOUNT([CNIC ]), USERELATIONSHIP(Payroll[Hiring Date],'Calendar'[Date]))

 
 
I hope this will help you 🙂

View solution in original post

Hello @Saad_Hanif456 ,

 

Please try below DAX

Head Count =
VAR _selectedMonthYear = FORMAT(MAX('Calendar'[Date]),"YYYY-MM")
VAR _table = SUMMARIZE(ALL(Payroll), [CNIC ], "HDdate", FORMAT(MIN([Hiring Date]), "YYYY-MM"))
RETURN COUNTROWS(FILTER(_table, [HDdate] = _selectedMonthYear))
VillyMBI_0-1709617875498.png
I hope this will help you 🙂

View solution in original post

5 REPLIES 5
Saad_Hanif456
Helper I
Helper I

Dear @VillyMBI,

Thank you so much for the response. 

Relationship is with Calendar [date] and Payroll Month [Date]

The result is not coming up what is required. I have got the hire count by your Dax suggestion but the employee the employee named Mr. Imtiaz hired in Jan 01, 2023. he is also reflecting in the month of April 2023 since his data of joining has been changed upon confirmation and I want his headcount comes onlyon the first hiring date i.e. Jan 01, 2023 when he was first hired

 

Please add your input, if you have got the understanding of it.

 

Regards,

Saad Hanif

 

Hello @Saad_Hanif456 ,

Please find updated Hiring.pbix  file.
I have added new relationship with Hiring Date as inactive.

Once again thank you @VillyMBI. I have got the New Hires Count but did not get the result that is required.

This Dax Expression Count the same Mr. Imtiaz name twice in Jan 01, 2023 and April 01, 2023 whereas i want his count reflected when he appointed first that is Jan 01, 2023.

Hello @Saad_Hanif456 ,

 

Please try below DAX

Head Count =
VAR _selectedMonthYear = FORMAT(MAX('Calendar'[Date]),"YYYY-MM")
VAR _table = SUMMARIZE(ALL(Payroll), [CNIC ], "HDdate", FORMAT(MIN([Hiring Date]), "YYYY-MM"))
RETURN COUNTROWS(FILTER(_table, [HDdate] = _selectedMonthYear))
VillyMBI_0-1709617875498.png
I hope this will help you 🙂
VillyMBI
Resolver I
Resolver I

Hello @Saad_Hanif456 ,

You have not specified anything about relationship between 'Calendar' and 'Payroll' table.
Considering you have an active relationship with 'Hiring date'
Head Count =DISTINCTCOUNT([CNIC ])


If not, considering you have an active relationship with 'Payroll Month' and a inactive relationship with 'Hiring date'

Head Count = CALCULATE(DISTINCTCOUNT([CNIC ]), USERELATIONSHIP(Payroll[Hiring Date],'Calendar'[Date]))

 
 
I hope this will help you 🙂

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors