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

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

Reply
danextian
Super User
Super User

Combine text from all available columns into one in Power Query

Hi All,

 

I've been trying to solve this on my own with no luck.

 

I have a table with many columns. Some colums have nulll values, some don't. I want to remove all rows with just null values in all columns. Column is nulll, column 2 is null, column 3 is null so on and so forth... so if the concatenation of all these columns result to null, the row will be removed. 

 

I wan to do the concatenation without having combine the columns one by one using ampersands or Text.Combne and Text.From

Would be great if this is possible.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
2 ACCEPTED SOLUTIONS

You can just remove blank rows:

 

Remove blank rows.png

 

Resulting code:

let
    Source = Table.FromColumns({{1,null,3},{null,null,null}},type table[Number1 = number, Number2 = number]),
    #"Removed Blank Rows" = Table.SelectRows(Source, each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
in
    #"Removed Blank Rows"

This checks both on nulls and "". If you only want to check for nulls, then you can adjust the code accordingly.

 

Specializing in Power Query Formula Language (M)

View solution in original post

v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @danextian,

I reproduce using my simple table.

1.PNG

You can create a custom column using the formula.

2.PNG
Then remove the rows based on the custom column. Please see my Query statement below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRQ0lEysQASQFasDlDAFMgGIkswDyRuZAwkLSCSRhCFOkrmMGkQAjFNwEqBhJlSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}, {"Column3", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if(([Column1]=null)and([Column2]=null)and([Column3]=null)) then null else 1),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each [Custom] <> null and [Custom] <> "")
in
    #"Filtered Rows"


I will get the expected result.

4.PNG

Best Regards,
Angelia

 

View solution in original post

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @danextian,

I reproduce using my simple table.

1.PNG

You can create a custom column using the formula.

2.PNG
Then remove the rows based on the custom column. Please see my Query statement below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRQ0lEysQASQFasDlDAFMgGIkswDyRuZAwkLSCSRhCFOkrmMGkQAjFNwEqBhJlSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}, {"Column3", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if(([Column1]=null)and([Column2]=null)and([Column3]=null)) then null else 1),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each [Custom] <> null and [Custom] <> "")
in
    #"Filtered Rows"


I will get the expected result.

4.PNG

Best Regards,
Angelia

 

vanessafvg
Super User
Super User

@danextian never tried it myself but @MarcelBeug has given me a formula before with list in power query maybe that can help?

 

https://msdn.microsoft.com/en-us/library/mt296612.aspx





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




You can just remove blank rows:

 

Remove blank rows.png

 

Resulting code:

let
    Source = Table.FromColumns({{1,null,3},{null,null,null}},type table[Number1 = number, Number2 = number]),
    #"Removed Blank Rows" = Table.SelectRows(Source, each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
in
    #"Removed Blank Rows"

This checks both on nulls and "". If you only want to check for nulls, then you can adjust the code accordingly.

 

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
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