Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I want to calculate headcount for the chosen End of Month (Nov-22) in this case. An employee can hae multiple date_to and Date_from records which captures the change of contract. Here is the situation:
For the above sample data
Total Employees =
VAR min_snapshot = CALCULATE(MIN(Parameter[End of Month]), ALLSELECTED())
VAR max_snapshot = CALCULATE(MAX(Parameter[End of Month]), ALLSELECTED())
VAR max_snapshot_2 = CALCULATE(MAX(Parameter[End of Month])+7, ALLSELECTED())
RETURN
CALCULATE(
DISTINCTCOUNT(unitt_hrreport_employee[user_id]),
UNION(
CALCULATETABLE(
VALUES(unitt_hrreport_employee[user_id]),
(
((unitt_hrreport_employee[date_from] > max_snapshot && unitt_hrreport_employee[date_from] < max_snapshot_2)
&& (unitt_hrreport_employee[date_to] > max_snapshot_2 || ISBLANK(unitt_hrreport_employee[date_to]) = TRUE))
),
FILTER(unitt_hrreport_employee, unitt_hrreport_employee[min_date_from_per_user_id] <= max_snapshot)
),
CALCULATETABLE(
VALUES(unitt_hrreport_employee[user_id]),
(
(unitt_hrreport_employee[date_from] <= max_snapshot
&& (unitt_hrreport_employee[date_to] > max_snapshot || ISBLANK(unitt_hrreport_employee [date_to] ) = TRUE)
)
))))
@tamerj1 @amitchandak @johnt75 @andhiii079845 @FreemanZ @Greg_Deckler Please help
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |