Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

sankar_ganesh
New Contributor

Cross table

Table 1:

ProductMericValueTarget
AAAMetric110
AAAMetric220
AAAMetric330
BBBMetric1100
BBBMetric2200
BBBMetric3300

Table_2:

ProductMetric1Metric2Metric3
AAA102030
BBB100200300

Hi,

I want to convert the table-1 in the table-2 format as specified above. Can anyone give your ideas ?

Thanks,

Sankar

Tags (2)
1 Solution

Accepted Solutions
lft
New Contributor III

Re: Cross table

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

3 Replies

Re: Cross table

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.


talk is cheap, supply exceeds demand
lft
New Contributor III

Re: Cross table

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

sankar_ganesh
New Contributor

Re: Cross table

Hi Loic,

Your document gives me the expected results. Thanks a lot!

Cheers,

Sankar

Community Browser