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 table which contains employees DateStarted and Leavedates. Leavedates is NULL if they are still active. In SQL I would run a where statement based on SSRS date parameters to only include active in a month period for example,
where (LeaveDate >= @datefrom and DateStarted < @dateto) or (DateStarted < @dateto and LeaveDate is NULL)
so if I replace the parameters with dates
where (LeaveDate >= '01 May 2020' and DateStarted < '01 Jun 2020) or (DateStarted < '01 Jun 2020) and LeaveDate is NULL)
... so this captures anyone who were active for any portion of this month for example, or even start before and finish after etc.
I am struggling to convert this to a measure so I can display a count of employees on a 3D card, based on a date slider linked to a calendar table, making this value dynamic. Thank you in advance.
Solved! Go to Solution.
@Beavertron
Use the following measure to get the active employees to count. Modify the table name and field names as per your model.
Employee Count =
VAR __DATE = MAX ( 'Date'[Date] )
RETURN
SUMX (
EmployeeTable,
IF (
EmployeeTable[DateStarted] <= __DATE
&& OR ( EmployeeTable[Leavedates] >= __DATE , ISBLANK(EmployeeTable[Leavedates]) ),
1,
BLANK ()
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Beavertron
Use the following measure to get the active employees to count. Modify the table name and field names as per your model.
Employee Count =
VAR __DATE = MAX ( 'Date'[Date] )
RETURN
SUMX (
EmployeeTable,
IF (
EmployeeTable[DateStarted] <= __DATE
&& OR ( EmployeeTable[Leavedates] >= __DATE , ISBLANK(EmployeeTable[Leavedates]) ),
1,
BLANK ()
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
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 |
|---|---|
| 10 | |
| 10 | |
| 8 | |
| 6 | |
| 6 |
| User | Count |
|---|---|
| 24 | |
| 19 | |
| 18 | |
| 15 | |
| 9 |