Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Filter and transpose data

Hi,

I have two tables. One with Date and associated values of sales. There is another table which has 2 columns :  CYDate,PYDate . I need to create new table with columns : CYDate, PYDate,CYValue,PYValue. I am finding it difficult to do the same qlikview. I need to do this at script level only for certain calculations. Can someone guide ?

Souce table 1 :

DateSales
1/1/2014123
1/2/2014124
1/3/2014125
1/4/2014123
1/5/2014124
1/6/2014124
1/7/2014124
1/8/2014124
1/9/2014124
1/10/2014125
1/2/2013125
1/3/2013125
1/4/2013125
1/5/2013125
1/6/2013125
1/7/2013125
1/8/2013125
1/9/2013125
1/10/2013125
1/11/2013126

Source Table 2:

CYDatePYDATE
1/1/20141/2/2013
1/2/20141/3/2013
1/3/20141/4/2013
1/4/20141/5/2013
1/5/20141/6/2013
1/6/20141/7/2013
1/7/20141/8/2013
1/8/20141/9/2013
1/9/20141/10/2013
1/10/20141/11/2013

Required result :

CYDateNPYDATECYSalesPYSales
1/1/20141/2/2013123125
1/2/20141/3/2013124125
1/3/20141/4/2013125125
1/4/20141/5/2013123125
1/5/20141/6/2013124125
1/6/20141/7/2013124125
1/7/20141/8/2013124125
1/8/20141/9/2013124125
1/9/20141/10/2013124125
1/10/20141/11/2013125126

Thanks,

Sailee

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Filter and transpose data

MapSales:

MAPPING LOAD

     Date,

     Sales

FROM

     SourceTable1;

Result:

LOAD

     CYDate,

     PYDATE as NPYDATE,

     applymap('MapSales',CYDate,0) as CYSales,

     applymap('MapSales',PYDate,0) as PYSales,

FROM

     SourceTable2;


talk is cheap, supply exceeds demand
2 Replies
MVP & Luminary
MVP & Luminary

Re: Filter and transpose data

MapSales:

MAPPING LOAD

     Date,

     Sales

FROM

     SourceTable1;

Result:

LOAD

     CYDate,

     PYDATE as NPYDATE,

     applymap('MapSales',CYDate,0) as CYSales,

     applymap('MapSales',PYDate,0) as PYSales,

FROM

     SourceTable2;


talk is cheap, supply exceeds demand
Not applicable

Re: Filter and transpose data

Thanks Gysbert.