Forum Discussion
Anonymous
3 years agoNot applicable
Headcount DAX Formula
Hello,
I am new to Power BI and need your precious help here.
My data is as follows:
My calendar is as follows:
What is the formula for headcount per month please?
I am trying this but it is not functioning..
Headcount = CALCULATE(DISTINCTCOUNT(Employees[EmployeeID]),FILTER(Employees,and(Employees[DateStart]<=[Selected date],OR(Employees[DateDeparture]=BLANK(),Employees[DateDeparture]>[Selected date]))))
Thank you so much for your assistance
Ariane
6 Replies
- johnt75
Super User
Try
Headcount = VAR SelectedDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Employees[EmployeeID] ), Employees[DateStart] <= SelectedDate && ( ISBLANK ( Employees[DateDeparture] ) || Employees[DateDeparture] > SelectedDate ) )- AnonymousNot applicable
Hello,
I am having this error
Cannot find the table 'Date'.
Thank you for your help
- johnt75
Super User
Change 'Date'[Date] to 'Calendar'[Date]
- AnonymousNot applicable