Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a table where I want to remove rows based on a given value in a column. For e.g., from the below table, I want to retain only the rows where Col D says "TBD". Hence, would want to retain rows 3 & 5 only and delete the rest. How can this be done using Power query? Any help would be appreciated. Thanks!
Col A | Col B | Col C | Col D |
aa | data | data | 123 |
bb | data | data | 321 |
cc | data | data | TBD |
dd | data | data | 456 |
ee | data | data | TBD |
Hi @SJHALANI ,
Hope you are doing well.
Please paste the below M Code in your Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7PUXBU0gHTTlDaGUq7KMXqRCslJgK5KYklSJShkTFYKikJQ8rYyBAslZyMIRXiBDEwJQVDysTUDCyVmopdVywA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Col A", type text}, {"Col B", type text}, {"Col C", type text}, {"Col D", type text}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each Text.Contains([Col D], "TBD"))
in
#"Filtered Rows"
If this helps then please give it a kudos and mark it as a solution.
Thank you.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
20 | |
10 | |
10 | |
10 |