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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Karla_hernandez
New Member

Need help with Position Changes DAX formula

I have a historical table that brings in employee data each month. This means the same employee can have multiple records in the table. I am trying to write a DAX measure that looks at the employee's latest position record. I would like to use this measure to create a position headcount visual. The measure below seems to get me the right headcount for the selected position but it does not allow me to use any other filters in the table

 

Team Lead Position Headcount =
VAR SelectedPosition = "IO0037- TEAM LEAD"
RETURN
CALCULATE(
    COUNTROWS(
        SUMMARIZE(
            FILTER(
                ALL('Employee List_Main Table'),
                'Employee List_Main Table'[Position] = SelectedPosition
                    && 'Employee List_Main Table'[Position Start Date] <= MAX('Calendar'[Date])
                    && ISBLANK('Employee List_Main Table'[Termination Date])
                    && 'Employee List_Main Table'[Hire Date] <= MAX('Calendar'[Date])
                    && 'Employee List_Main Table'[ReHire Date] <= MAX('Calendar'[Date])
            ),
            'Employee List_Main Table'[Employee Code]
        )
    )
)
 
Ideally, I would like to have a measure that allows me to pull multiple positions in one column chart and allows me to use the table filters
4 REPLIES 4
parry2k
Super User
Super User

@Karla_hernandez I'm tagging @Greg_Deckler and I believe he already solved it many times.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks! I will keep searching for an answer in the meantime

parry2k
Super User
Super User

@Karla_hernandez there are so many posts on doing the head count. did you take the time to search for it and see if existing solution will work for you?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes I have been searching for a solution for over a week now. I have a seperate headcount report that calculates headcount based on an employees single record

 

In this case I want to account for any position changes an employee has had and only want to include in the count the employees latest record. For example, In june an employee may be in X position and they should be included in the X position headcount for June but in July that employee moved to Y position and should now be included in the Y positon for July headcount. 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors