There's probably an easy way to do this with PowerQuery, but I can't think of it. I want to turn this:
Into this:
...Basically just copying the first instance of each ACODE into an inserted line as a Keyword above its associated other keywords:
Any ideas?
You can group on ACODE with option All Rows, then add a row to the nested tables, remove the original ACODE column and expand the column with nested tables.
let
Source = Input,
#"Grouped Rows" = Table.Group(Source, {"ACODE"}, {{"AllData", each _, type table}}),
#"Inserted Row" = Table.TransformColumns(#"Grouped Rows",{{"AllData", each Table.InsertRows(_,0,{[ACODE = null, Keyword = _[ACODE]{0}]})}}),
#"Removed Columns" = Table.RemoveColumns(#"Inserted Row",{"ACODE"}),
#"Expanded AllData" = Table.ExpandTableColumn(#"Removed Columns", "AllData", {"ACODE", "Keyword"}, {"ACODE", "Keyword"})
in
#"Expanded AllData"