Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

month year format

i have a master table which has

yearmonth as 201612

and another table yearmonth as dec 2016

need to join the to tables on id and this monthyear flag

but both date are in different format (they are string values)

how to convert and den join these two tables.

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try below functions to convert them into date.

1. Date(Date#(yearmonth,'YYYYMM')) as NewyearMonth

2. Date(Date#(OtherDate,'MMM YYYY')) as NewOtherDate

Now you can use this fields to link each other.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

its in string format so this function doesn't work directly

vineetadahiya12
Contributor III
Contributor III

Hi, Try the below code. This may help in converting the yearmonth format from 201612 to Dec 2016

Date1:

Load * inline [

Date_1

201612

201601

201602];

Date2:

Load * Inline [

Date_2

Dec 2016

Feb 2016

Jan 2016];

--------format date from Date1 alongwith your other column

load Date(Date#(Date_1,'YYYYMM'),'MMM YYYY')

Resident Date1;

vineetadahiya12
Contributor III
Contributor III

Try this - this will convert Dec 2016 to 201612

this may be helpful as well

Date(Date#(Date_2,'MMM YYYY'),'YYYYMM')  

Anonymous
Not applicable
Author

so shud I do a left join

or just load table,beacuse it will hve synthetic keys two common columns are there

how to approach for this data model

Anonymous
Not applicable
Author

kndly help