Filter in magic ETL
Hi, I am trying to filter a dataset using magic ETL. The logic involves examining each id in the id column and then return the row with the highest rank. This will remove duplicate ids. I have attached images showing an example: before transformation and the desired output result (after). Can we achieve this using magic ETL? Thanks
Best Answers
-
Yes - you can use the Rank and Window tile to create a rank based on your id. Then use the filter tile to return the rank you want. If you want the min id you can just sort ascending on your rank/window function and then filter to where rank=1. If you want the max id, you can sort descending and then filter to where rank=1. In your case, if you're wanting the min rank per group. You would need to partition by ID to start the rank over again for each id.
For example. Input dataset
The above is how you could set up your rank/window tile.
Example output
Filter to where rank = 1
This output matches your example requested result.
David Cunningham
** Was this post helpful? Click Agree π, Like ποΈ, or Awesome β€οΈ below **
** Did this solve your problem? Accept it as a solution! βοΈ**2 -
I think David's reply is correct if you don't have a rank field yet. If the rank field already exists, you instead would have to group by the id to find the max(rank), and inner join that back to the data, with the join fields being id = id and rank = max(rank).
3
Answers
-
Yes - you can use the Rank and Window tile to create a rank based on your id. Then use the filter tile to return the rank you want. If you want the min id you can just sort ascending on your rank/window function and then filter to where rank=1. If you want the max id, you can sort descending and then filter to where rank=1. In your case, if you're wanting the min rank per group. You would need to partition by ID to start the rank over again for each id.
For example. Input dataset
The above is how you could set up your rank/window tile.
Example output
Filter to where rank = 1
This output matches your example requested result.
David Cunningham
** Was this post helpful? Click Agree π, Like ποΈ, or Awesome β€οΈ below **
** Did this solve your problem? Accept it as a solution! βοΈ**2 -
I think David's reply is correct if you don't have a rank field yet. If the rank field already exists, you instead would have to group by the id to find the max(rank), and inner join that back to the data, with the join fields being id = id and rank = max(rank).
3 -
Thanks @david_cunningham and @Sean_Tully . I actually have both cases one without the rank and another one with rank, so thank you both for the insightful answers. I was able to filter the data.π
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive