Getting latest value from a grouping in Power BI measure

colinhahn

New Member
Joined
Jan 4, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am attempting to create a Power BI measure that computes the number of active employees and that can be sliced by date, based on a table that is a running list of employment changes.

As a sample data set:
Employee IDChange DateStatusTitleChange Reason
A1/1/2021ActiveDirector of StuffHired
B2/1/2021ActiveMinionHired
A5/1/2021ActiveVP of StuffPromotion
B6/1/2021TerminatedMinionFired
C8/1/2021ActiveMinionHired
B9/1/2021ActiveMinionRehired

My expected output:
DateActive EmployeesDetail
1/1/20211A
2/1/20212A and B
5/1/20212Still A and B, even though A appeared twice
6/1/20211Just A, since B was terminated
8/1/20212A and C; B is still terminated
9/1/20213A, B, and C; A and B only count once even though they have multiple lines, and even though B was hired and rehired (only the most recent status counts)

I'm not sure how to create this kind of measure. In plain language, I want to get a table of the most recent one entry for each person (with change dates on or before the date in question), and I want to count how many of those most recent entries have a status active.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top