Forum Discussion
smpa01
Community Champion
7 years agoCustom Lookup
Hello experts, I have a table (raw data) as following Index CAT1 CAT1Value CAT2 CAT2Value CAT3 CAT3Value 1 CAT1 100 CAT2 200 CAT3 300 2 CAT1 500 CAT2 100 CAT3 200 ...
- Anonymous7 years ago
smpa01,
You can create the custom column with this formula below"CAT" & Text.From(List.PositionOf({[CAT1Value], [CAT2Value], [CAT3Value]}, List.Max({[CAT1Value],[CAT2Value],[CAT3Value]})) + 1) - 7 years ago
Hi smpa01
Try this:
let Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"CAT1", type text}, {"CAT1Value", Int64.Type}, {"CAT2", type text}, {"CAT2Value", Int64.Type}, {"CAT3", type text}, {"CAT3Value", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Max_CAT1_CAT2_CAT3", each List.Max({[CAT1Value],[CAT2Value],[CAT3Value]})), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each if [CAT1Value] = [Max_CAT1_CAT2_CAT3] then "CAT1" else if [CAT2Value] = [Max_CAT1_CAT2_CAT3] then "CAT2" else if [CAT3Value] = [Max_CAT1_CAT2_CAT3] then "CAT3" else null)
in #"Added Custom1" - 7 years ago
Anonymousthis is awesome mate. Thanks !!!
- Anonymous7 years ago
Actually this is a better solution for the custom column to adapt to your table
{[CAT1], [CAT2], [CAT3]}{List.PositionOf({[CAT1Value], [CAT2Value], [CAT3Value]}, List.Max({[CAT1Value],[CAT2Value],[CAT3Value]}))}
Anonymous
7 years agoNot applicable
smpa01,
You can create the custom column with this formula below
"CAT" & Text.From(List.PositionOf({[CAT1Value], [CAT2Value], [CAT3Value]}, List.Max({[CAT1Value],[CAT2Value],[CAT3Value]})) + 1)smpa01
Community Champion
7 years agoAnonymousthis is awesome mate. Thanks !!!