Pivoting multiple columns to one, while keeping correlating data
Ok pretty sure I need to creat a pivot table of some kind, to move data that extends in rows across an unknown number of columns, and bring it all into one uniform column. The problem I have is keeping the associated row data when you move the data into one column. See below --->
What I have:
What I need:
How do I do this?
Best Answer
-
There's a couple of different ways to handle something like this. If all of your data looks like your example, you could import the original dataset and then do a data transform like the one below:
SELECT COL1, COL2, COL3 FROM Dataset
UNION ALL
SELECT COL1, COL2, COL4 FROM Dataset
UNION ALL
SELECT COL1, COL2, COL5 FROM DatasetORDER BY COL1
(My input dataset)
(My results)
Just change the column and table names to whatever you end up naming your own table and that should do the trick.
If you have any questions or problems implementing, just let me know.
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the thumbs up if this post helped you.
2
Answers
-
Awesome, thanks for the response. So can I do this using ETL or would I need to do a tradtional SQL transformation?
0 -
Unfornately the ETL option limits you to only using Joins. So this would need to be a MySQL transformation in order to do it this way.
If you have any issues creating the SQL Data flow, don't hesitate to ask.
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the thumbs up if this post helped you.1 -
So it doesn't look like I have access to the MySQL transform tool in Domo. Reaching out to support to get this activated. Thanks for the help.
0 -
Thanks, Valiant Spur. This helped me out in a major way.
1
Categories
- 7.7K All Categories
- 5 Connect
- 921 Connectors
- 244 Workbench
- 477 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 40 Visualize
- 199 Beast Mode
- 2K Charting
- 8 Variables
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- Workflows
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 28 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 14 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部