'Power Query Concatenate list values from record without expanding to rows
I have an API JSON response that provides some company data. It includes a list of Company IDs and a record for sic_codes which is stored as a list (as there can be many sic codes for one company)
Currently, I'm expanding the values to rows and then using a custom column to group and combine them into a format like "sic1, sic2, sic3"
Is there a way to create this concatenated column without first expanding the rows?
here's a preview of the data:
Solution 1:[1]
How about
#"Transform" = Table.TransformColumns(#"PriorStepNameGoesHere",{{"sic_codes", each try Combiner.CombineTextByDelimiter(", ")(List.Transform( _ , each Text.From(_))) otherwise null }})
or
#"Added Custom" = Table.AddColumn(#"PriorStepNameGoesHere, "expanded_SICs", each try Text.Combine(List.Transform([sic_codes], each Text.From(_)),", ") otherwise [sic_codes])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

