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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil_sawargave
Contributor III
Contributor III

Merge Three Column Into One Column As "DATE1"

Hi Community,

I have two table, here in one table there is one column for "DATE " & in the second Column There are three column like "DAY",  "MONTH", "YEAR ". Here "Day " column of Second Table generated after doing Unpivot the Field.

Here i want to merge Second Table Three  column "Day", "MONTH", "YEAR" into one column As "DATE1" .

Then I want to Mapping the First table "DATE" Column Map with Second Table "DATE 1" Column .

 sunil_sawargave_0-1665046655481.png

Thanks & Regards

Sunil

Labels (2)
6 Replies
rubenmarin
MVP
MVP

Hi, after unpivot you can create the date using Makedate() as: Makedate(YEAR,MONTH,DAY) as Date1.

If in table1 you create a composite key with date and shop name, you can create the same composite key in table 2 and join both tables.

Or first do a mapping table using table with the composite key and use Applymap on the first table using the mapping table.

ajaykakkar93
Specialist III
Specialist III

hi,

use makedate function 

 

Sample code:

 

data1:
//step 1
Mapping load MakeDate(Year,Month,Day) as Date1,
Value;
load * Inline [
Day,Month,Year,Value
02,03,2022,200
22,03,2022,500
14,03,2022,800
21,04,2022,2300
];


data2:
load Date,rand() as rand,
ApplyMap('data1',Date,'Missing') as Value;
load * Inline [
Date,Dim
02/03/2022,dim1
22/03/2022,dim2
14/03/2022,dim3
21/04/2022,dim1
18/04/2022,dim2
29/04/2022,dim3
];

exit Script;

PFA the image attached

 

 

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

sunil_sawargave
Contributor III
Contributor III
Author

Hi,

Thank You Rubenmarin,

Where to write this function, in Seperate script or In expression.

Thanks & Regards

Sunil

rubenmarin
MVP
MVP

Hi, all this has to be done in the script.

Regards.

ajaykakkar93
Specialist III
Specialist III

u need to write above in data load editor 

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

sunil_sawargave
Contributor III
Contributor III
Author

hi,

Thanks Ajay Kakkar, 

Can i create new separate script & write on that ,is it ok ,

data1:
//step 1
Mapping load MakeDate(Year,Month,Day) as Date1,
Value;
load * Inline [
Day,Month,Year,Value
02,03,2022,200
22,03,2022,500
14,03,2022,800
21,04,2022,2300
];


data2:
load Date,rand() as rand,
ApplyMap('data1',Date,'Missing') as Value;
load * Inline [
Date,Dim
02/03/2022,dim1
22/03/2022,dim2
14/03/2022,dim3
21/04/2022,dim1
18/04/2022,dim2
29/04/2022,dim3
];

exit Script;