Forum Discussion
alameda
6 years agoNew Member
Conditional column which merges all coincident values
Hi: I'm trying to get a conditional column which merges all the values from the column B which value in the column A is the same. For example, mi desiredColumn would be something like this: col...
- 6 years ago
You can do it more simply like:
let Source = #table(type table [columnA=Int32.Type, columnB=text], {{1, "A"}, {2, "B"}, {2, "C"}, {3, "D"}, {3, "E"}, {3, "F"}, {4, "G"}}), #"Added Custom" = Table.AddColumn(Source, "desiredColumn", each Text.Combine(Table.SelectRows(Source, (x) => [columnA] = x[columnA])[columnB], "|")) in #"Added Custom"
Greg_Deckler
6 years agoCommunity Champion
Well, if it doesn't have to be Power Query, then the DAX is:
DAX Column =
VAR __Table = FILTER(ALL('Table'),'Table'[columnA]=EARLIER('Table'[columnA]))
RETURN
CONCATENATEX(__Table,[columnB]," | ")
If it has to be Power Query, ImkeF can likely tell you how to do it. I attached a PBIX.