Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I would like to know if there is any way to delete some data I do not need on power query?
for example in this data base in the column Type I have "production/ dups/ samples" for my report I only need "production" so I will like to delete all the raws that says "dups and samples" and to have in the date base only production.
PO | ID Code | Quantity | Type |
20305 | SN0647P02NG02842 | 5 | Production |
20305 | SN0647P02NGC0012 | 10 | Production |
20305 | SN0647P02NGC0022 | 5 | Dups |
AD2078M01MGC001S | 1 | Samples | |
20311 | AD1874D02MGC003S | 12 | Dups |
AD2078M01MGC001S | 1 | Samples | |
AD2086M01MGC002S | 4 | Dups | |
AD2086M01MGC002S | 1 | Dups | |
AD2087M01MGC002S | 1 | Dups | |
AD2087M01MGC002S | 1 | Dups | |
AD2087M01MGC002S | 1 | Samples | |
20317 | AD2088M01MGC002S | 1 | Samples |
20317 | AD2088M01MGC002S | 1 | Samples |
AD2089M01MGC001S | 1 | Samples | |
20317 | AD2090M01MGC001S | 1 | Samples |
20317 | AD2090M01MGC001S | 1 | Samples |
20301 | AD2026P01MGC001L | 12 | Production |
20301 | AD2026P01MGC001L | 12 | Production |
20301 | AD2026P01MGC001M | 15 | Production |
20301 | AD2026P01MGC001M | 15 | Production |
20301 | AD2026P01MGC001S | 10 | Production |
20317 | AD2091M01MGC001S | 1 | Samples |
20301 | AD2026P01MGC001XL | 10 | Production |
20301 | AD2026P01MGC002L | 12 | Production |
20301 | AD2026P01MGC002L | 12 | Production |
thank you
Solved! Go to Solution.
If you want to delete the entire row, just filter it. If you just want to delete the value of the Type column (that is, set it to null), you can check the following formula:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tdNNC4JAEAbgvxKePcyMm7seI6GLiuAlEA9RHYJKyfz/uUtTYGsfascdnn0XZnby3CHwYO64TpaAL2QKlKyAlKC2pMvppdw12+uhPDuFa9VLANQa4VtOHB42VW3crD0sQgKpYsDYRGY6Ul/dnKrjvuY4RENRSRECGeoZSgPymCmfGWkmbFEdg1Yj/2a6bZBM1VT08XjwcQacGMCEFPBOyU+ZRjxZy78az2PNez75eJ7178SzKzikK+vozbq9evqtLXZe3AA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PO = _t, #"ID Code" = _t, Quantity = _t, Type = _t]),
// or Table.TransformColumns(Source, {"Type", each if _ <> "Production" then null else _})
Result = Table.TransformColumns(Source, {"Type", each if List.Contains({"Dups", "Samples"}, _) then null else _})
in
Result
As follows:
leaving you with:
You cannot delete but you can filter out rows you do not need.
Table.SelectRows(previousQueryStep, each [Type] = "Production") would select all rows that have 'Production' as the value in the Type column.
Proud to be a Super User! | |