Forum Discussion
DarshanKumar
Helper II
1 year agoCalculating Active Employees by specific Date
Hi, Im trying to calculate the active employees by month. My employee table has duplicate values , multiple rows of data for an employee. Each row has the same start date and end date and job infor...
- 1 year ago
Hello DarshanKumar,
Can you please try this approach:
ActiveEmployeesPerDepartment = VAR SelectedMonth = MAX('Calendar'[Date]) RETURN CALCULATE ( DISTINCTCOUNT ( 'Job Information'[Emp ID] ), FILTER ( ADDCOLUMNS ( SUMMARIZE ( 'Job Information', 'Job Information'[Emp ID], 'Job Information'[Department], "LatestChange", CALCULATE ( MAX ( 'Job Information'[Job Information: Date] ), FILTER ( 'Job Information', 'Job Information'[Emp ID] = EARLIER('Job Information'[Emp ID]) && 'Job Information'[Department] = EARLIER('Job Information'[Department]) && 'Job Information'[Job Information: Date] <= SelectedMonth ) ) ), "HireCheck", CALCULATE ( MIN ( 'Job Information'[Hire Date] ) ), "TermCheck", CALCULATE ( MAX ( 'Job Information'[Terminaion Date] ) ) ), [HireCheck] <= SelectedMonth && (ISBLANK([TermCheck]) || [TermCheck] > SelectedMonth) ) )
DarshanKumar
Helper II
1 year agoSahir_Maharaj Thank you very much it worked. Im a new bie in Dax and power BI. Thank you very much for your help.