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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
robsmith1980
Frequent Visitor

Remove duplicated rows based on values of other columns

Hi,

 

I hope someone can help.

 

I have a dataset as summarised below - the actual data sets is many thousands of rows and covers 5 years worth of data.

 

Where the Subscriptionid, USD and Date columns ALL contain dupicate values, i want to remove any row with the PartnerAttributionType of "Record" - IE for the subcriptionids below, I just want to be left with the rows showing Admin

 

The same subscriptionid could have the same USD value on multiple dates, so i can't just remove duplicates, etc.

 

All help greatly appreciated!

 

SubscriptionidUSDPartnerAttributionTypeDate
E100008387404500Admin30/09/2020
E100008387404500Record30/09/2020
E64748496000Admin30/09/2020
E64748496000Record30/09/2020
E989799875000Admin30/09/2020
E363939375000Record30/09/2020
E100008387408000Admin28/08/2020
E100008387408000Record28/08/2020
E64748492500Admin28/08/2020
E64748492500Record28/08/2020
E989799877000Admin28/08/2020
E363939377000Record28/08/2020
8 REPLIES 8
manikumar34
Solution Sage
Solution Sage

@robsmith1980 

 

You can also use the bwlow M query to do that. 

= Table.SelectRows(#"Changed Type", each [PartnerAttributionType] = "Admin")

 

Regards, 

Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




themistoklis
Community Champion
Community Champion

Hello @robsmith1980 

 

In Power Query editor do right click on the value 'Record' --> Text Filters --> Does Not Equal

 

See image below

 

Exclude.jpg

Thanks - just to be 100% clear, will that only remove the rows where "SubscriptionID", "USD" and "Date" all contain duplicate values?

 

IE If a SubscriptionID has two rows showing the same USD and Date Value, but different PartnerAttirbutionTypes, it will just remove the row where PartnerAttributrionType = "Record"?

 

There will be instances where one of the Sub ID, USD or Date columns isn't duplicated, and these would need to remain

@robsmith1980 

 

Have you tried any of the actions we described above to see if they cover your needs?

 

You mentioned 

Where the Subscriptionid, USD and Date columns ALL contain dupicate values, i want to remove any row with the PartnerAttributionType of "Record" - IE for the subcriptionids below, I just want to be left with the rows showing Admin

My understanding is that you want to get rid of records with value = 'Record'. Am i right?

@themistoklis  - No, not quite, I am afraid - All of the solutions so far just remove the rows showing "Record" under Partner Attribution Type - apologies if have not explained it clearly

 

The data set contains a list of Subscriptions, showing a USD value, a bill date and a Partner Attribution Type.

 

The same subscription ID will appear on multiple dates and may or may not have the same USD value.

 

Some subscriptions may have rows showing both "Record" and "Admin", some will just have one or the other.

 

I need to remove rows from the dataset where the Subscription ID AND the USD Value AND the Date column are duplicated, but where the Partner Attribution Type is set to "Record"  - The below table is perhaps a better representation of the true dataset

 

SubscriptionidUSDPartnerAttributionTypeDate
E100008387404500Admin30/09/2020
E100008387404500Record30/09/2020
E64748496000Record30/09/2020
E989799875000Admin30/09/2020
E363939375000Record30/09/2020
E100008387408000Admin28/08/2020
E100008387408000Record28/08/2020
E64748492500Admin28/08/2020
E989799877000Admin28/08/2020
E363939377000Record28/08/2020

@robsmith1980 

 

Try using Remove rows > Remove Duplicates which will remove the columns which seem like duplicated on the entire table.

 

If you want delete the records whcih are duplicated and are on Record type, I afraid that I don't have a solution for now, need toc check with this. Let me know if the above option works else let's check further to get you the correct solution. 

 

Regards, 

Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




manikumar34
Solution Sage
Solution Sage

@robsmith1980 , 

 

If your data is same like as you shared here and wants to remobve Record type and keep only Admin data, Use Power query. 

 

Remove Rows>Remove alternative rows. 

 

Regards, 

Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Unfortunately, its not that simple - there are multiple rows and not every alternative row needs to be removed

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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