Forum Discussion

dimes's avatar
dimes
Helper I
5 years ago
Solved

Concatenate values from other table column

Hi community,

 

I have two tables:

 

Now I want to have in table project a new column with the values from Project_Mega[Mega] seperated by ",":

 

How can I achieve this? 

 

thanks

dima

 

 

2 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi dimes 

    Place the following M code in a blank query to see the steps to apply to table Project. The last 2 are the important ones. See it all at work in the attached file.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQooys9KTS5RSFSK1YlWMgKKhKQWl4A5xlCOMZhnAuQlJiWD2aZAdkpqGphtBmQrxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Desc = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", Int64.Type}}),
    
    
        #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Project"}, Project_Mega, {"Project"}, "Project_Mega", JoinKind.LeftOuter),
        #"Aggregated Project_Mega" = Table.AggregateTableColumn(#"Merged Queries", "Project_Mega", {{"Mega", each Text.Combine(_,","), "Mega", type text}})
    in
        #"Aggregated Project_Mega"

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers