Pivoting multiple columns with the same column values as its values
I have a scenario where I have rows from multiple columns that I want to pivot into a multiple columns. Let's say I have three columns: 'Questions,' 'Labels,' and 'Values.' I tried pivoting the 'Questions' column into separate columns with values from the 'Values' column.
Now, I also want to pivot the 'Labels' column into separate columns, and the column should have a value from the 'Values' column.
I am unable to add two columns to pivot at once; it only allows me to select one column to choose the labels I want.
How can I achieve this?
Answers
-
The way you describe it, you are pivoting on the values in column, "Values". After that pivot, you would have Questions, Labels, and new columns, based on "Values", but not the values column itself. I would think if you want to pivot twice off the same column "Values", you would have to duplicate the column before the pivots.
I think you have to try it in multiple steps. Start by pivoting the first column. This will create a new dataset with the first column pivoted. Which you would configure and save. Then pivot again.Let's assume you have a dataset with columns:
Date
,Category
,Metric
, andValue
.Date
Category
Metric1
Metric2
Value
2023-07-01
A
X
Alpha
10
2023-07-01
B
X
Beta
15
2023-07-02
A
Y
Alpha
20
2023-07-02
B
Y
Beta
25
Our goal is to pivot both
Metric1
andMetric2
columns.Intermediate Dataset (after Pivoting
Metric1
)Date
Category
Metric2
X
Y
2023-07-01
A
Alpha
10
2023-07-01
B
Beta
15
2023-07-02
A
Alpha
20
2023-07-02
B
Beta
25
Final Dataset (after Pivoting
Metric2
)Date
Category
Metric1
Alpha
Beta
2023-07-01
A
X
10
2023-07-01
B
X
15
2023-07-02
A
Y
20
2023-07-02
B
Y
25
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Thank you so much for your response. However, in the above example, I see only one metric being pivoted at a time. I am trying to pivot two metrics simultaneously. I tried creating a duplicate dataset through SQL transform, created two separate pivots for each metric, and then joined the two pivoted datasets.
However, I observed that my pivot does not include multiple rows for a single identified row. For example, if the single identified row is 'Submission ID' and there are multiple values for a single submission ID in the pivoted columns, it displays only one response.
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.8K Visualize
- 2.5K Charting
- 731 Beast Mode
- 55 App Studio
- 40 Variables
- 682 Automate
- 175 Apps
- 451 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 122 Manage
- 119 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 107 Community Announcements
- 4.8K Archive