sandy666
05-10-2020, 12:11 AM
Return label and header for max value
labelheader 1header 2header 3header 4header 5labelheaderValue
label 1
1
2
3
4
5label 3header 4
9
label 3
6
7
8
9
0
label 5
1
0
3
4
6
label 7
2
3
3
4
2
labelheader 1header 2header 3header 4header 5labelheaderValue
label 1
1
2
3
4
5label 3header 4
9
label 3
6
7
8
9
0label 7header 2
9
label 5
1
0
3
4
6
label 7
2
9
3
4
2
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Unpivot = Table.UnpivotOtherColumns(Source, {"label"}, "Attribute", "Value"),
Filter = Table.SelectRows(Unpivot, each ([Value] = List.Max(Unpivot[Value]))),
Ren = Table.RenameColumns(Filter,{{"Attribute", "header"}})
in
Ren
labelheader 1header 2header 3header 4header 5labelheaderValue
label 1
1
2
3
4
5label 3header 4
9
label 3
6
7
8
9
0
label 5
1
0
3
4
6
label 7
2
3
3
4
2
labelheader 1header 2header 3header 4header 5labelheaderValue
label 1
1
2
3
4
5label 3header 4
9
label 3
6
7
8
9
0label 7header 2
9
label 5
1
0
3
4
6
label 7
2
9
3
4
2
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Unpivot = Table.UnpivotOtherColumns(Source, {"label"}, "Attribute", "Value"),
Filter = Table.SelectRows(Unpivot, each ([Value] = List.Max(Unpivot[Value]))),
Ren = Table.RenameColumns(Filter,{{"Attribute", "header"}})
in
Ren