Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Table 1:
Product | MericValue | Target |
AAA | Metric1 | 10 |
AAA | Metric2 | 20 |
AAA | Metric3 | 30 |
BBB | Metric1 | 100 |
BBB | Metric2 | 200 |
BBB | Metric3 | 300 |
Table_2:
Product | Metric1 | Metric2 | Metric3 |
AAA | 10 | 20 | 30 |
BBB | 100 | 200 | 300 |
Hi,
I want to convert the table-1 in the table-2 format as specified above. Can anyone give your ideas ?
Thanks,
Sankar
Hi Sankar,
PFA the solution to your question
you should copy paste the pivot sub and then call :
CALL fr.qliktech.pivot('Table 1', 'Product', 'Sum', 'MetricValue', 'Target');
You could do it the other way around using the unpivot function
Loic
Yes, don't do it in the script. Use a pivot table object with Product and MetricValue as dimensions. Drag the header of MetricValue to the right above the expression so the dimension values are shown horizontally.
Hi Sankar,
PFA the solution to your question
you should copy paste the pivot sub and then call :
CALL fr.qliktech.pivot('Table 1', 'Product', 'Sum', 'MetricValue', 'Target');
You could do it the other way around using the unpivot function
Loic
Hi Loic,
Your document gives me the expected results. Thanks a lot!
Cheers,
Sankar