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

Don'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.

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
Super User
Super User

As follows:

 

p45cal_0-1733332731879.png

 

leaving you with:

 

p45cal_1-1733332777903.png

 

View solution in original post

3 REPLIES 3
ZhangKun
Super User
Super User

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
Super User
Super User

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.