Forum Discussion
Remove duplicates only if the duplicate values contain a certain text
- 5 years ago
Nandor
You will have to do a different approach. I added a conditional column and an Index column and removed the duplicates. Please check the attached file below my signature.
My Sample Data
Output
You should be able to do it like so:
= Table.Distinct(NameOfPriorStep, {{"Name", Text.Contains(_, "WRS")}})
--Nate
Dear Watkinnc,
Thank you for the solution, it is working, however I am trying to avoid duplicating columns or tables because I have a database that has almost 700.000 records and it is getting slower and slower with each modification like this. I am looking for a solution that doesent need anly column addition or query duplicaiton. I need also to take in consideration an another column.
The original data looks like this:
StoresArticle
| Store1 | Article1 |
| Store1 | Article1 |
| Store1 | Article1 |
| Store1 | Article2 |
| Store1 | Article3 |
| Store1 | Article3 |
| Store1 | Article4 WRS |
| Store1 | Article4 WRS |
| Store1 | Article5 WRS |
| Store1 | Article5 WRS |
| Store2 | Article1 |
| Store2 | Article1 |
| Store2 | Article1 |
| Store2 | Article2 |
| Store2 | Article3 |
| Store2 | Article3 |
| Store2 | Article4 WRS |
| Store2 | Article4 WRS |
| Store2 | Article5 WRS |
| Store2 | Article5 WRS |
And I need it transformed to this:
StoresArticle
| Store1 | Article1 |
| Store1 | Article1 |
| Store1 | Article1 |
| Store1 | Article2 |
| Store1 | Article3 |
| Store1 | Article3 |
| Store1 | Article4 WRS |
| Store1 | Article5 WRS |
| Store2 | Article1 |
| Store2 | Article1 |
| Store2 | Article1 |
| Store2 | Article2 |
| Store2 | Article3 |
| Store2 | Article3 |
| Store2 | Article4 WRS |
| Store2 | Article5 WRS |
I would need a code to add it in one step without addin and the removing columns or duplicationg queries.
Saple file: Dropbox link to sample file
Thank you,