Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
Author

Thanks Gysbert.