Removing duplicates
Hi, I need help coming up with logic for this problem. I have a dataset that looks like this:
ID Source 1 A 1 A 1 B 1 B 2 A 3 B
I want to only remove rows from source A IF that same row is also in source B. Otherwise I want to keep rows unique to source A and unique to source B. The output should look like this:
ID Source 1 B 1 B 2 A 3 B
Thank you
Best Answer
-
@jrtomici Yes I re-read your question and realized that my original solution would not work. What I would recommend is self joining the data on itself for every record in A. This way you can compare each row of data in A with every row in B and look for matches. This will temporarily explode your data, but you can then filter it down before the output.
If I solved your problem, please select "yes" above
0
Answers
-
Using the remove duplicates tile in magic etl you can choose what fields make a row unique. So in your case you would select just ID and Name to search for the duplicates.
EDIT: I re-read your question and the above solution would not get you what you are looking for. You would need to self join the data with itself so that the data can be compared to itself row by row. This will temporarili yexplode your data but hen you can filter it down before the final output.
If I solved your problem, please select "yes" above
1 -
@jrtomici If you are using MagicETL, try using a Group By tile to condense your table. Set ID and Name as your columns to group by, and add a formula grouping for MAX(Source). Note that this will keep the source that is last alphabetically since your example includes "A" and "B" as your values, but you may need to use MIN instead if the value you want to keep is first alphabetically.
0 -
@ColemenWilson Ugh I apologize — what makes this complicated is that the Name field is not unique. So there is no unique identifier for each row across both sources.
0 -
@jrtomici Yes I re-read your question and realized that my original solution would not work. What I would recommend is self joining the data on itself for every record in A. This way you can compare each row of data in A with every row in B and look for matches. This will temporarily explode your data, but you can then filter it down before the output.
If I solved your problem, please select "yes" above
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive