Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Lookup and Concatenate

Hello, I'm new to Power BI and looking for a solution for my scenario below:   I have a SharePoint field that has multiple values in one column. This is in the form of an ID. I call this Table A  ...
  • ryan_mayu's avatar
    2 years ago

    Anonymous 

    vicky_ 's solution is great. Just add another solution for the last step.

    you can group by in the PQ

    = Table.Group(#"Expanded Table B", {"Index"}, {{"id", each Text.Combine([User_ID],","), type nullable text}, {"name", each Text.Combine([Name],","), type nullable text}})

     

    then delete the index column

     

     

    pls see the attachment below

     

     

  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"User_ID", type text}}),
        Custom1 = Table.ToRows(Table2),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(List.ReplaceMatchingItems(Text.Split([User_ID],", "),Custom1),", ")),
        #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"User_ID"})
    in
        #"Removed Columns"

    Hope this helps.