Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi there, could anyone help me in Power Query to pick the row for each student that has the max date below?
I have an extra issue that for some students there is more than one max date, so i would then choose the status column that has the earliest letter in the alphabet!
Example data below with required output. Thank you in advance for any help!
Student
Name Date Status
Student 1 12/01/2021 A
Student 1 10/01/2021 C
Student 1 12/01/2021 B
Student 2 09/01/2021 B
Student 2 08/01/2021 C
Student 2 09/01/2021 A
Student 3 01/01/2021 A
Student 3 03/01/2021 B
Student 3 04/01/2021 C
Student 3 18/01/2021 D
Desired Output:
Student
Name Date Status
Student 1 12/01/2021 A
Student 2 09/01/2021 A
Student 3 18/01/2021 D
Solved! Go to Solution.
Hi, @Moliems
let
Source = you_table,
gr =
Table.Group(
Source, "Name",
{"r",
each
Table.FirstN(
Table.Sort(_, {{"Date", Order.Descending}, {"Status", Order.Ascending}}),
1
)
}
),
z = Table.Combine(gr[r])
in
z
Thank you! I think this does the trick!
Hi, @Moliems
let
Source = you_table,
gr =
Table.Group(
Source, "Name",
{"r",
each
Table.FirstN(
Table.Sort(_, {{"Date", Order.Descending}, {"Status", Order.Ascending}}),
1
)
}
),
z = Table.Combine(gr[r])
in
z
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.