Pivot tables
I dunno why, but some of the time I cannot wrap my head around pivot tables. Here is what I want to do and here is how my data is structured and the column headers….
Account | A Prime_TV Revenue | B Prime_TV Revenue | A Premium_TV Revenue | B Premium_TV Revenue
Pivot table I want…
TV Category | Company A. | Company B
Prime_TV. | $500000 |. $6000000
Premium_tv. |. $55000. |. $5000
Is this possible given the data structure that i have?
Best Answer
-
since there are only 4 columns you can directly use a SQL dataflow to convert the data in the format you want and avoid any pivot stuff in ETL:
select Account, 'A' as company, 'Prime_TV' as TV Category, A Prime_TV Revenue as value from Table
union all
select Account, 'A' as company, 'Premium_tv' as TV category, A Premium_TV Revenue as value from Table
union all
select Account, "B" as company, "Prime_TV" as TV category, B Prime_TV Revenue as value from Table
union all
select Account, "B" as company, "Premium_tv" as TV category, B Premium_TV Revenue as value from Table
In the above code, Table is the name of the datasource where this data is stored. Once you have the data in the above format, you can just create a pivot table card and drag 'company' field to Columns and 'TV category' field to Rows and the 'value' column to Values and you should get the data in the format you want in a card.
0
Answers
-
since there are only 4 columns you can directly use a SQL dataflow to convert the data in the format you want and avoid any pivot stuff in ETL:
select Account, 'A' as company, 'Prime_TV' as TV Category, A Prime_TV Revenue as value from Table
union all
select Account, 'A' as company, 'Premium_tv' as TV category, A Premium_TV Revenue as value from Table
union all
select Account, "B" as company, "Prime_TV" as TV category, B Prime_TV Revenue as value from Table
union all
select Account, "B" as company, "Premium_tv" as TV category, B Premium_TV Revenue as value from Table
In the above code, Table is the name of the datasource where this data is stored. Once you have the data in the above format, you can just create a pivot table card and drag 'company' field to Columns and 'TV category' field to Rows and the 'value' column to Values and you should get the data in the format you want in a card.
0
Welcome!
Welcome!
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 660 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 778 Automate
- 190 Apps
- 482 APIs & Domo Developer
- 83 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 412 Distribute
- 120 Domo Everywhere
- 281 Scheduled Reports
- 11 Software Integrations
- 145 Manage
- 141 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive