Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table with 2 columns that I want to union like this:
Column 1 | Column 2 | Union |
apple, orange, aple | apple, lemon | apple, orange, lemon |
Is there a custom formula I can write? Or do I need to make a PQ function?
It would be great to customize the delimiter as well.
Thanks for any of your ideas, @Jimmy801 @Greg_Deckler @amitchandak @parry2k @Mariusz @ImkeF
Solved! Go to Solution.
Add a step prior to this one. Select both columns and use Replace Values to convert the nulls to blanks.
Then use this function to remove the blanks from the combined list.
= Text.Combine(List.Select(List.Distinct(Text.Split([Column1], ",") & Text.Split([Column2], ",")), each _ <> ""), ", ")
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
FYI this is a duplicate post.
You can add a custom column with this function. Prior to this step, you can Replace Values and put a space and no value in the 2nd box to get rid of the spaces first if needed.
= Text.Combine(List.Distinct(Text.Split([Column1], ",") & Text.Split([Column2], ",")), ", ")
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I spoke too soon...your solution cannot handle null values for col1 or col2.
I tried to add an if statement inside but looks like I got the syntax wrong.
= Table.AddColumn(Source, "Combined", each Text.Combine(List.Distinct(if [Langs 1] = null then null else Text.Split(Text.Lower([Langs 1]), ", ") & if [Langs 2] = null then null else Text.Split(Text.Lower([Langs 2]), ", ")), ", "))
Add a step prior to this one. Select both columns and use Replace Values to convert the nulls to blanks.
Then use this function to remove the blanks from the combined list.
= Text.Combine(List.Select(List.Distinct(Text.Split([Column1], ",") & Text.Split([Column2], ",")), each _ <> ""), ", ")
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
6 | |
6 | |
6 |