Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hey guys 🙂
I want to remove rows containing string in power query. Is there any option to solve my problem? 🙂
Solved! Go to Solution.
Hi @Anonymous
If you are looking to preserve rows that contain numbers only, you can try this.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKNjQyVorViVaC0cYQKrEixdTMXCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Filtered Rows" = Table.SelectRows(Source, each Text.Length( Text.Remove([Column1], {"0".."9"} ) ) = 0 )
in
#"Filtered Rows"
Also, see the attached for the ref.
Hi @Anonymous ,
You could split the column to digital column and non-digital column. Then keep the "null" rows in the non-digital column. At last, remove the extra column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VIrVAdGOYNrEyEQpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Split Column by Character Transition" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Column1.1", "Column1.2"}),
#"Filtered Rows" = Table.SelectRows(#"Split Column by Character Transition", each ([Column1.2] = null)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Column1.2"})
in
#"Removed Columns"
Hi @Anonymous
If you are looking to preserve rows that contain numbers only, you can try this.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKNjQyVorViVaC0cYQKrEixdTMXCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Filtered Rows" = Table.SelectRows(Source, each Text.Length( Text.Remove([Column1], {"0".."9"} ) ) = 0 )
in
#"Filtered Rows"
Also, see the attached for the ref.
Hi @Anonymous
Sure, try the solution in my previous post it do just that.
considers that:
Text.Length( Text.Remove("+2345645", {"0".."9"} ))=1
try
Value.Type(Value.FromText("+2345645"))
or
Number.FromText("+2345645")
Number.FromText("+234wa5645")
or
Value.Is(value as any, type as type) as logical
PS
Could please someone explain me how to do to attach/upload some scriptfile?
Hi @Anonymous
Sure, can you provide a data sample for your scenario?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |