Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
AmandaMulryan
Frequent Visitor

HR Employee Headcount Matrix

I'm trying to create a matrix that allows me to display the start of month (SOM) and end of month (EOM) employee headcounts by month and by driver type or by terminal. The formulas I currently have are correct for the totals, but do not work in the matrix (i.e. cannot be filtered by the driver type or terminal). I've included a screenshot of the matrix and the DAX formulas for the current SOM and EOM headcounts. How do I write this so that they are filtereable in the matrices by terminal or driver type? Everything I've tried does not give correct counts. 

 

AmandaMulryan_1-1661180554741.png

 

 

Total Driver Count SOM =
VAR selectedDate = MIN('Date'[Date])

RETURN

SUMX(ALL(Drivers),
VAR employeeStartDate = [HiredOn]
VAR employeeEndDate = [TermedOn]
RETURN IF(employeeStartDate <= selectedDate && OR(employeeEndDate >= selectedDate, employeeEndDate = BLANK()),1,0))
 
 
Total Driver Count EOM =
VAR selectedDate = MAX('Date'[Date])

RETURN

SUMX(ALL(Drivers),
VAR employeeStartDate = [HiredOn]
VAR employeeEndDate = [TermedOn]
RETURN IF(employeeStartDate <= selectedDate && OR(employeeEndDate >= selectedDate, employeeEndDate = BLANK()),1,0))
2 REPLIES 2
amitchandak
Super User
Super User

@AmandaMulryan , Use Min and Max on date of date column, in formula used in blog

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Or refer file attached. Use Min/Max for start and end of month  on date of date table in measure

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I have that already written out in the formulas I listed. The formulas I listed are correct with the totals. However, as seen in the screenshot, they do not calculate correctly BY driver type or BY terminal, as well as per month. I am looking to get the total SOM and EOM counts per month, PER Terminal or PER driver type. They will only give me the overall total.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.