Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi
I have a dax for a KPI that I can’t seem to make work. What I want is to count, the number og employees that has been active every month in the filtered period. The data looks like this:
I figured that I need to know how many months are in the period, I did that this way
V – Number of months= CALCULATE(DISTINCTCOUNT('HRPM SKF'[ID]), ALLEXCEPT('HRPM SKF','HRPM SKF'[EOM]))
This work fine, but I can’t make a dax that counts how many employees that has been active every month in the filtered period.
I tried with:
V – Number of employees =
Var months = V – Number of months
Var number = DISTINCTCOUNT('HRPM SKF'[Medarbejdernr-W (HRPM)])
Return
if(number=moths,1,0)
This works fine, when I do a list with employee IDs in it. But not when I aggregate in a KPI.
Jesper
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
I suggest having a dim-calendar table like below.
Active employee count: =
VAR employeetable =
ADDCOLUMNS (
VALUES ( Data[ID] ),
"@startdate", CALCULATE ( MIN ( Data[EOM] ) ),
"@enddate", CALCULATE ( MAX ( Data[EOM] ) )
)
RETURN
COUNTROWS (
FILTER (
employeetable,
[@startdate] <= MAX ( 'Calendar'[Date] )
&& [@enddate] >= MIN ( 'Calendar'[Date] )
)
)
Hi,
Please check the below picture and the attached pbix file.
I suggest having a dim-calendar table like below.
Active employee count: =
VAR employeetable =
ADDCOLUMNS (
VALUES ( Data[ID] ),
"@startdate", CALCULATE ( MIN ( Data[EOM] ) ),
"@enddate", CALCULATE ( MAX ( Data[EOM] ) )
)
RETURN
COUNTROWS (
FILTER (
employeetable,
[@startdate] <= MAX ( 'Calendar'[Date] )
&& [@enddate] >= MIN ( 'Calendar'[Date] )
)
)
Yes. however i only wanna count them if they have been active every month in the periode. Lets say i set my period filter to "From 30-06-2021 to 31-07-2021" then it should 2. Because only James and Ivan have been acticve in both months
Then you just need to create new measure
Number Of Employees =
DISTINCTCOUNT('HRPM SKF'[ID])
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 8 | |
| 5 | |
| 3 |
| User | Count |
|---|---|
| 28 | |
| 21 | |
| 20 | |
| 18 | |
| 12 |