Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I want to delete all rows of Column "test" which contain less than 4 characters.
E.g. "132" should be removed, "testtest" should not be removed.
I have tried the following in M but there is a syntax error:
= if Text.Length([test]) <4 then Table.RemoveRows(Table.FromRecords,1)
Solved! Go to Solution.
Hi @max_mustermann ,
I can just tell you alternate way, since you are already checking Text.Length, just filtering records <4 or >3 will serve the purpose:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ2UorViVYqSS0uAWGl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [test = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"test", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Test-Length", each Text.Length([test])),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Test-Length", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [#"Test-Length"] > 3)
in
#"Filtered Rows"
Hi @max_mustermann ,
I can just tell you alternate way, since you are already checking Text.Length, just filtering records <4 or >3 will serve the purpose:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ2UorViVYqSS0uAWGl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [test = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"test", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Test-Length", each Text.Length([test])),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Test-Length", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [#"Test-Length"] > 3)
in
#"Filtered Rows"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
99 | |
76 | |
67 | |
61 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |