Use case
You are to aggregate headers from the Dev-stage 1 to Dev-stage 5 columns by their values and products.
Solution
- Switch the page to the edit mode.
- Insert the Table Transformer macro and paste the table or the macros outputting tables within the macro body.
- Select the macro and click Edit.
- In the Presets tab select Custom transformation and click Next.
Enter the following SQL query:
SELECT 'Product', 'Value', ARRAY('Dev-stage') AS 'Dev-stage' FROM ( SELECT * FROM T1 UNPIVOT ('Value' for 'Dev-stage' in (T1.'Dev-stage 1',T1.'Dev-stage 2',T1.'Dev-stage 3',T1.'Dev-stage 4',T1.'Dev-stage 5'))) GROUP BY 'Product', 'Value'
- Save the macro.
- Insert another Table Transformer and wrap the previously created layout with the macro.
- Select the macro and click Edit.
- In the Presets tab select Custom transformation and click Next.
Enter the following SQL query:
SELECT * FROM T1 PIVOT (FIRST ('Dev-stage') for 'Value')
- Save the macro and the page.