Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gtaranti
Frequent Visitor

Table.Combine : How to handle null values?

Hi all!

 

I want to merge ALL columns except the first one on the depicted table.

The column count is dynamic. There maybe more than these.

ss.png

 

I'm using the code :

= Table.CombineColumns(TransposedTable , List.Skip(Table.ColumnNames(TransposedTable ),1),  Combiner.CombineTextByDelimiter(" / ", QuoteStyle.None),"Merged")

to merge all columns except the 1st.

 

My probem is how to tackle null values, because in these rows I get :

Συγκατάθεση: Μέσω On-line φόρμας /  /  / Επεξεργασία απαραίτητη για την εκτέλεση σύμβασης 

(Sorry for the language, this is greek!)

 

Is there a function I can write to modify Combiner.CombinTextByDelimiter() in order to OMIT null values?

1 ACCEPTED SOLUTION
gtaranti
Frequent Visitor

A post in an other thread helped me to find my own solution.

 

Instead of Merging the columns at once, I added a custom column first that uses Text.Combine and at the same time removing NULLs, like that :

 

    AddedCustom = Table.AddColumn(Source ,  "Merged", (row) => Text.Combine( List.RemoveNulls(List.Skip(Record.FieldValues(row),1)), " / " )),

The community here is very helpful! Smiley Very Happy

View solution in original post

6 REPLIES 6
gtaranti
Frequent Visitor

A post in an other thread helped me to find my own solution.

 

Instead of Merging the columns at once, I added a custom column first that uses Text.Combine and at the same time removing NULLs, like that :

 

    AddedCustom = Table.AddColumn(Source ,  "Merged", (row) => Text.Combine( List.RemoveNulls(List.Skip(Record.FieldValues(row),1)), " / " )),

The community here is very helpful! Smiley Very Happy

Nice. I didn't know about that function.

stretcharm
Memorable Member
Memorable Member

You can use replace to change to a blank string

 

Enter null in the value to find.

 

= Table.ReplaceValue(#"Changed Type1",null,"",Replacer.ReplaceValue,{"YourColumn"})

Unfortunately replacing  null  with  blank string has the same effect.  

 

 "String1"  |  null  | "String2"   =>  String1 / / String2
 "String1"  |  ""  | "String2"   =>  String1 / / String2

Ah sorry, misread your request.

 

You can replace duplicate delimiters with a single one. If there is a chance you can have 3 then repeat the replace,

 

E.g.

/ /   to  /

 

 

 

If you have lots of colums and potential nulls you could pivot all but the first row, filter out nulls then unpivot back. However this is probably slower tha just replacing the duplicate delimiters.

Yes, I tried that, but there is also the problem with null in the first column.   (or multiple consecutive nulls).

 

 

This could be :  

null  |  "String1" | "String2"  =>   / String1 / String2

 

It's tough to get them all with replacements afterwards.

If I can't find a solution for omission of nulls DURING Table.Combine, I will go this path (i.e. replace all multiple delimeters and remove first & last ones)

 

Thanks..

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors