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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Saad_Hanif456
Helper I
Helper I

Count of Employees

Dear Experts,

I wanted to know how many employees joined in both years from the following sample data.

  • If I am using the distinct count function on code then it is calculating the employee twice since the code is different but the employee’s name and CNIC is the same.
  • We can only calculate the headcount by CNIC number since it is the same in 2023 and 2023 like Mr. Ali in the sample data, using the distinct count function but if I use that it counts Mr. Ali on Jan 24 as well where it has already been joined on Jan 2023.

Please suggest the DAX calculation as suggested in the required table:

 

Sample Data:

S.NoCodeName CNIC Joining Date
110438Imtiaz4555588777101-01-23
210320Safdar4555588777201-01-23
310553Ali 4555588777301-01-23
410042Hussain4555588777401-01-23
510399Arbaas4555588777501-02-23
610953Waseem4555588777601-02-23
710993khurram4555588777701-02-23
810164adil4555588777801-02-23
910847sunny4555588777901-02-23
1010959maheen4555588778001-03-23
1110541Idrees4555588778101-03-23
1210326Ijaz4555588778201-03-23
1310507Sibghat4555588778301-03-23
1410319Alina4555588778401-03-23
110333Ali 4555588777301-01-24
210945zakir4555588777401-01-24
310951shehzad4555588777501-01-24
410671Muslim4555588777601-01-24
510392ghulam4555588777701-02-24
610011rashid4555588777801-02-24
710796khurram4555588777901-02-24
810606adil4555588778001-02-24
910328sunny4555588778101-02-24
1010401maheen4555588778201-03-24
1110372Idrees4555588778301-03-24
1210058Ijaz4555588778401-03-24
1310735Sibghat4555588778501-03-24
1410507Zakir4555588777401-03-24

 

Required result:

YearMonthNo. of EmpRequired
2024Jan43
2024feb55
2024Mar54
  1412

 

Regards,

Saad Hanif

4 REPLIES 4
Saad_Hanif456
Helper I
Helper I

I have also attached the sample PBIX files in the google drive, need to calculate the Hires month wise and condition mentioned in the remarks column

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


Please help me in this regards so that i am able to move forward.

Saad_Hanif456
Helper I
Helper I

Dear Experts,

 

Please help me in this regards

 

Regards,

Saad Hanif

wdx223_Daniel
Super User
Super User

=COUNTROWS(Except(SUMMARIZE(Table1,Table1[CNIC],Table1[Name]),CALCULATETABLE(SUMMARIZE(Table1,Table1[CNIC],Table1[Name]),'Table1'[Joining Date]<MIN('Calendar'[Date]),ALL('Calendar'))))

wdx223_Daniel_0-1708933171031.png

 

Thank you for the help but it is not happening, may be i have a slicer of Calendar [month] and calendar [year]

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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