Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
bobbydave
Creator III
Creator III

Swapping numbers

I've a number of dates that I want to look like

201509

201508

.

.

.

201008 etc

The date right now looks like e.g. 15/12/2015 (European format).

I would like it to look like above so I've gotten so far.

=right(purgechar(Calls.Date,'/'),6)


will give me 122015


now I want to get it to look like 201512


I could get both values but how do I reverse concatenate?


right(right(purgechar(Calls.Date,'/'),6) ,2) gives me 12

left(right(purgechar(Calls.Date,'/'),6) ,4) gives me 2015

but how do I reverse it so the 2015 comes out first and then the 12???

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

Sample script:

Table:

LOAD DateField,

  Date(Date#(DateField, 'DD/MM/YYYY'), 'YYYYMM') as NewDateField;

LOAD Date(Today() + RecNo()) as DateField

AutoGenerate 365;

Output:

Capture.PNG

View solution in original post

8 Replies
sunny_talwar

Try this:

Date(Date#(DateField, 'DD/MM/YYYY'), 'YYYYMM') as DateField

sasiparupudi1
Master III
Master III

try

Date(date#(yourdate,'DD/MM/YYYY'),'YYYYMM')

sunny_talwar

Sample script:

Table:

LOAD DateField,

  Date(Date#(DateField, 'DD/MM/YYYY'), 'YYYYMM') as NewDateField;

LOAD Date(Today() + RecNo()) as DateField

AutoGenerate 365;

Output:

Capture.PNG

View solution in original post

sunilkumarqv
Specialist II
Specialist II

SET DateFormat='M/D/YYYY';

change to

SET DateFormat='YYYYMD';

or

=SubField(Date,'/',3)&''&SubField(Date,'/',2)&''&SubField(Date,'/',1)

qlikviewwizard
Master II
Master II

Hi Try Like this:

SET DateFormat='M/D/YYYY';


Data:

LOAD *,Date(Date#(DATE_VALUE, 'DD/MM/YYYY'), 'YYYYMM')as DATE_VALUE_Target INLINE

[DATE_VALUE

25/12/2015

15/11/2015

5/10/2015

25/12/2014

15/11/2014

5/10/2014

]

Capture.PNG

Capture.PNG

bobbydave
Creator III
Creator III
Author

Everyone .... I cant believe I asked that question. I do apologise.

I was on holidays for two weeks and overcomplicated something so simple.

sunny_talwar

It happens to all of us

But I am glad, all of us were able to quickly help you out.

Best,

Sunny

qlikviewwizard
Master II
Master II

Hi, BobbyDave,

It is a learning dude.