Forum Discussion
New Hires Count
- 2 years ago
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 🙂 - 2 years ago
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))
I hope this will help you 🙂
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.
- Saad_Hanif4562 years ago
Helper I
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.
- VillyMBI2 years ago
Resolver I
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))
I hope this will help you 🙂