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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Kudoed Authors