- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Merge 4 Columns ONLY if not Null
I have 4 columns I want to Merge, some Cols have Null others dont, so end result looks like
cust1,toys,,bikes
cust2,,,bikes
cust3,toys,,
etc
how can i merge only if not null so end result will look like this....just a cleaner output
cust1,toys,bikes
cust2,bikes
cust3,toys
etc
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Add a custom column with the formula
Text.Combine(Record.ToList(_), ",")
Each row in the table is a record like [Column1 = "cust1", Column2 = "toys", Column3 = null, Column4 = "bikes"] and Record.ToList converted this record into a list like {"cust1", "toys", null, "bikes"} and Text.Combine concatenates them.
Full sample query:
let
Source =
Table.FromRows(
{
{ "cust1", "toys", null, "bikes" },
{ "cust2", null, null, "bikes" },
{ "cust3", "toys", null, null }
},
type table [Column1 = text, Column2 = text, Column3 = text, Column4 = text]
),
#"Added Custom" = Table.AddColumn(Source, "Merge", each Text.Combine(Record.ToList(_), ","), type text)
in
#"Added Custom"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Replace Combiner.CombineTextByDelimiter(",", QuoteStyle.None) with
each Text.Combine(List.RemoveNulls(_),",")
Or instead of transforming the column, just Add Column Ribbon --> Merge and it will already remove the nulls from my own testing. You can then manually delete the columns you just merged.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Add a custom column with the formula
Text.Combine(Record.ToList(_), ",")
Each row in the table is a record like [Column1 = "cust1", Column2 = "toys", Column3 = null, Column4 = "bikes"] and Record.ToList converted this record into a list like {"cust1", "toys", null, "bikes"} and Text.Combine concatenates them.
Full sample query:
let
Source =
Table.FromRows(
{
{ "cust1", "toys", null, "bikes" },
{ "cust2", null, null, "bikes" },
{ "cust3", "toys", null, null }
},
type table [Column1 = text, Column2 = text, Column3 = text, Column4 = text]
),
#"Added Custom" = Table.AddColumn(Source, "Merge", each Text.Combine(Record.ToList(_), ","), type text)
in
#"Added Custom"

Helpful resources
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-24-2025 12:00 PM | |||
12-13-2019 03:04 AM | |||
06-02-2025 03:46 PM | |||
05-19-2025 02:02 PM | |||
10-15-2021 07:17 AM |
User | Count |
---|---|
9 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
13 | |
11 | |
9 | |
6 | |
6 |