Magic ETL - filling values in a column based on other values in the same column
Hi there,
Ran into a bit of a roadblock with my MagicETL. I was able to get to a certain point using the Rank & Window function but I can't figure out how to do the next step I need.
Below is an example of where I'm at after combining two tables and partitioning them based on ID and sorting them by date.
ID | Date | Stage | Activity | Rank |
123 | 01-Jan-18 | 1 | ||
123 | 02-Jan-18 | Call | 2 | |
123 | 03-Jan-18 | Stage 1 | 3 | |
123 | 04-Jan-18 | 4 | ||
123 | 05-Jan-18 | 5 | ||
123 | 06-Jan-18 | Call | 6 | |
123 | 07-Jan-18 | Stage 2 | 7 | |
123 | 08-Jan-18 | Call | 8 | |
123 | 09-Jan-18 | Call | 9 | |
123 | 10-Jan-18 | Stage 3 | 10 | |
456 | 04-Jan-18 | 1 | ||
456 | 05-Jan-18 | 2 | ||
456 | 06-Jan-18 | Stage 2 | 3 | |
456 | 07-Jan-18 | Call | 4 | |
456 | 08-Jan-18 | 5 | ||
456 | 09-Jan-18 | Call | 6 | |
456 | 10-Jan-18 | Stage 4 | 7 |
I would like to fill in the blank "stage" cells with the stage of the latest stage in the series. Example:
ID | Date | Stage | Activity | Rank |
123 | 01-Jan-18 | Stage 1 | 1 | |
123 | 02-Jan-18 | Stage 1 | Call | 2 |
123 | 03-Jan-18 | Stage 1 | 3 | |
123 | 04-Jan-18 | Stage 2 | 4 | |
123 | 05-Jan-18 | Stage 2 | 5 | |
123 | 06-Jan-18 | Stage 2 | Call | 6 |
123 | 07-Jan-18 | Stage 2 | 7 | |
123 | 08-Jan-18 | Stage 3 | Call | 8 |
123 | 09-Jan-18 | Stage 3 | Call | 9 |
123 | 10-Jan-18 | Stage 3 | 10 | |
456 | 04-Jan-18 | Stage 2 | 1 | |
456 | 05-Jan-18 | Stage 2 | 2 | |
456 | 06-Jan-18 | Stage 2 | 3 | |
456 | 07-Jan-18 | Stage 4 | Call | 4 |
456 | 08-Jan-18 | Stage 4 | 5 | |
456 | 09-Jan-18 | Stage 4 | Call | 6 |
456 | 10-Jan-18 | Stage 4 | 7 |
Does anyone know if this is possible in Magic ETL, and if so, what's the best way of doing this?
Thanks in advance.
Best Answer
-
Got it! Took a bit of thinking but here you go. I took the example dataset you gave me as the "Entry" and was able to do it with the following steps:
Here's the details for each step:
Always interesting trying to do things like this in ETL.
Best of luck!
Valiant
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.3
Answers
-
Got it! Took a bit of thinking but here you go. I took the example dataset you gave me as the "Entry" and was able to do it with the following steps:
Here's the details for each step:
Always interesting trying to do things like this in ETL.
Best of luck!
Valiant
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.3 -
Thank you so much for this, i managed to do it another way over the weekend but your way is definitely cleaner I'll keep this in mind when I run into the same situation again.
0 -
How to do if there is just one dataset involved and I want to fill down a column just as we do in Excel?
1
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 603 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 697 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 386 Distribute
- 111 Domo Everywhere
- 269 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 8 Domo University
- 30 Product Releases
- Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive