Forum Discussion
jtsmit7
6 years agoNew Member
Headcount/inventory over time from a transaction table
Hi all, I am currently working on an HR Report that is meant to track headcount at our company. We pull this data from UltiPro, and it comes out in a transaction table. That is, every time a ne...
- 6 years ago
Hi, jtsmit7
Based on your description, I created data to reproduce your scenario.
Table:
Calendar(a calculated table):
Calendar = CALENDARAUTO()Employee ID(a calculated table):
Employee ID = DISTINCT('Table'[Employee ID])There is a many-to-one relationship between 'Table' and 'Calendar'.
You may create two measures as follows.
IsActive = var _date = SELECTEDVALUE('Calendar'[Date]) var _id = SELECTEDVALUE('Employee ID'[Employee ID]) var _result = LOOKUPVALUE( 'Table'[Empolyee Status], 'Table'[Effective Date], CALCULATE( MAX('Table'[Effective Date]), FILTER( ALL('Table'), 'Table'[Employee ID] = _id&& 'Table'[Effective Date]<=_date ) ) ) return IF( _result = "Active", 1, IF( _result = "Terminated", 0 ) ) Count = SUMX( 'Employee ID', [IsActive] )Results:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
6 years agoCreate an Employee table and have a Start Date of the MIN date where they are Active. Also have an End Date for the Termination date. Then you can use something like Open Tickets: https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364