Data transformation Question
I am working on a report where the data looks like below (sample data):
Services : JAS, GAF and YAG fall under the profit center "ABC" and HIG and OPD falls under "XYZ"
Date | Profit Center | Service |
---|---|---|
1/1/24 | ABC | |
1/1/24 | JAS | |
1/1/24 | GAF | |
1/1/24 | YAG | |
1/1/24 | XYZ | |
1/1/24 | HIG | |
1/1/24 | OPD |
I want my final output to look like below, there should be a profit center for each service in each row.
Date | Profit Center | Service |
---|---|---|
1/1/24 | ABC | XCS |
1/1/24 | ABC | JAS |
1/1/24 | ABC | GAF |
1/1/24 | ABC | YAG |
1/1/24 | XYZ | HIG |
1/1/24 | XYZ | OPD |
Can someone please guide me how can we do that in domo etl ? I know that window functions (lag,lead) aren't supported in Domo's mysql, so trying to find a solution with magic etl.
Thankyou
Best Answer
-
I think you want to fill down the
Profit Center
column, and once you've created a filled down Profit Center column, you could filter out the blankService
rows.Here's a good explanation from @MichelleH on filling down using Group-By and Coalesce in MagicETL:
I also like the Python implementation from @user01506 (except that Python in a MagicETL feels like putting on a lobster bib at a Denny's)
Please ๐ก/๐/๐/๐ this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0
Answers
-
Do the services map to profit centers? For example, is XCS always in the ABC profit center? How many total services & profit centers are there? Are there any other fields that group profit centers together?
If I solved your problem, please select "yes" above
0 -
@SS1108 If the service centers always map to the same profit center you could use a mapping table that joins into the ETL or you can do a beastmode/formula tile like below
case
when 'service' in ('XCS', 'JAS', 'GAF', 'YAG') then 'ABC'
when 'service' in ('HIG','OPD') then 'XYZ'
end
**If this answer solved your problem be sure to like it and accept it as a solution!
0 -
I think you want to fill down the
Profit Center
column, and once you've created a filled down Profit Center column, you could filter out the blankService
rows.Here's a good explanation from @MichelleH on filling down using Group-By and Coalesce in MagicETL:
I also like the Python implementation from @user01506 (except that Python in a MagicETL feels like putting on a lobster bib at a Denny's)
Please ๐ก/๐/๐/๐ this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
@DavidChurchman the explanation fromย @MichelleHย was really helpful. I was able to successfully map the data. Thank you so much
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