March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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.
Proud to be a Super User!
Solved! Go to Solution.
You can just remove blank rows:
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.
Hi @danextian,
I reproduce using my simple table.
You can create a custom column using the formula.
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.
Best Regards,
Angelia
Hi @danextian,
I reproduce using my simple table.
You can create a custom column using the formula.
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.
Best Regards,
Angelia
@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
Proud to be a Super User!
You can just remove blank rows:
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
105 | |
99 | |
64 | |
54 |