Forum Discussion
imranamikhan
3 years agoHelper V
Get second highest value per group in Power Query
Hi everyone, I have a table with a list of projects. Each project is duplicated per the number of reporting periods. The reporting period is identified by a number column. I am curre...
- 3 years ago
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project Name", type text}, {"Reporting Period", Int64.Type}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Project Name"}, {{"2nd latest reporting period", each try List.Sort([Reporting Period],Order.Descending){1} otherwise 1, type nullable number}}) in #"Grouped Rows"Hope this helps.
imranamikhan
3 years agoHelper V
As always thanks for the support Ashish_Mathur.
deevaker thanks for the suggestion but there is a specific reason I need an M-Query solution.
Ashish_Mathur
3 years agoSuper User
You are welcome.