Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply
Marango
Regular Visitor

DELETE DATA FROM A COLUMN IN POWER QUERY

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.

 

POID CodeQuantityType
20305SN0647P02NG028425Production
20305SN0647P02NGC001210Production
20305SN0647P02NGC00225Dups
 AD2078M01MGC001S1Samples
20311AD1874D02MGC003S12Dups
 AD2078M01MGC001S1Samples
 AD2086M01MGC002S4Dups
 AD2086M01MGC002S1Dups
 AD2087M01MGC002S1Dups
 AD2087M01MGC002S1Dups
 AD2087M01MGC002S1Samples
20317AD2088M01MGC002S1Samples
20317AD2088M01MGC002S1Samples
 AD2089M01MGC001S1Samples
20317AD2090M01MGC001S1Samples
20317AD2090M01MGC001S1Samples
20301AD2026P01MGC001L12Production
20301AD2026P01MGC001L12Production
20301AD2026P01MGC001M15Production
20301AD2026P01MGC001M15Production
20301AD2026P01MGC001S10Production
20317AD2091M01MGC001S1Samples
20301AD2026P01MGC001XL10Production
20301AD2026P01MGC002L12Production
20301AD2026P01MGC002L12Production

 

thank you

1 ACCEPTED SOLUTION
p45cal
Resolver IV
Resolver IV

As follows:

 

p45cal_0-1733332731879.png

 

leaving you with:

 

p45cal_1-1733332777903.png

 

View solution in original post

3 REPLIES 3
ZhangKun
Resolver V
Resolver V

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

 

p45cal
Resolver IV
Resolver IV

As follows:

 

p45cal_0-1733332731879.png

 

leaving you with:

 

p45cal_1-1733332777903.png

 

jgeddes
Super User
Super User

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.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors