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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MichaelF1
Helper III
Helper III

Selecting one row based on criteria if another field is duplicated

I have a table of products (SKUs) showing whether they are live or discontinued.

 

Unfortunately there are some products that are showing as Live and Discontinued on two different rows. If a product appears twice, I want to delete the Discontinued row.

 

What I have: 

ProductStatus
SKU1live
SKU1discontinued
SKU2live
SKU3

discontinued

 

What I need:

ProductStatus
SKU1live
SKU2live
SKU3discontinued

 

Thanks in advance!

 

 

4 REPLIES 4
mussaenda
Super User
Super User

mussaenda_0-1698762426652.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvYONVTSUcrJLEtVitWB81Myi5Pz80oy80pTU2DiRmjqQPxEhZLU4hKYiDGGzlgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, Status = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Product"}, {{"Count", each List.Max([Status]), type nullable text}})
in
    #"Grouped Rows"

 

BA_Pete
Super User
Super User

Hi @MichaelF1 ,

 

If the relevant words are always "Live" and "Discontinued", you can group your table by [Product] and create an aggregated column that is MAX of [Status].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hello Pete and thanks for the reply!

It isn't always Live and Discontinued, but you have given me an idea: I can create a new column and substitute a number for the status (there are only about 5 differnet ones so possible to hard code), then just group and aggregate on that.

Does that sound like it would work?

 

Yes, the principle seems sound.

Difficult to say whether it would stand up to changing values, but it's a simple enough solution to amend/update.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.