robertdseals
Active Member
- Joined
- May 14, 2008
- Messages
- 337
- Office Version
- 2010
- Platform
- Windows
Hello all, I have a table with multiple entries for employees. I've grouped this table by employee number and I've aggregated the data by Max for day, and Max for other columns. However, I am trying to get the last entry for "company" (we have 3 companies). When I use "Max" or List.Last in the M Code, I get the last company alphabetically not chronalogically. Any thoughts on how to fix this?
Power Query:
= Table.Group(#"Removed Other Columns", {"EmployeeNumber"}, {{"MaxDay", each List.Max([ActualDate]), type nullable datetime}, {"MaxName", each List.Max([FullName]), type nullable text}, {"MaxActiveStat", each List.Max([ActiveStatus]), type nullable text}, {"MaxHireDate", each List.Max([HireDate]), type nullable datetime}, {"MaxRehireDate", each List.Max([RehireDate]), type nullable datetime}, {"MaxTermDate", each List.Max([TerminationDate]), type nullable datetime}, {"MaxCompany", each List.Last([Company]), type nullable text}, {"MaxManager", each List.Max([Manager]), type nullable text}, {"MaxDepartment", each List.Max([DeptCode]), type nullable text}, {"MaxLocation", each List.Max([WorkLocation]), type nullable text}, {"MaxDeptName", each List.Max([DepartmentName]), type nullable text}})