Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Convert YYYY-WW to Date

Hello,

Is it possible to convert a YYYY-WW date format into a single date? Lets say the last day of that week?

Tags (3)
1 Solution

Accepted Solutions

Re: Convert YYYY-WW to Date

Hi,

     In that case you can try this.

     MakeWeekDate(left(Field,4),if(len(Field)=7,right(field,2),right(field,1)),0)

Regards,

Kaushik Solanki

 

12 Replies
MVP
MVP

Re: Convert YYYY-WW to Date

Use MakeWeekDate() function.

Example:

=MakeWeekDate(Left('2013-09',4),Right('2013-09',2),6)   // the red '6' tells about the last day of the week, you can modify accordingly.

Re: Convert YYYY-WW to Date

Hi,

     Yes. Consider that the YYYY-WW is the text then you can use the below expression to get the date.

MakeWeekDate(left(Field,4),right(field,2),0)

     Here 0 is considered as monday of that week.

Regards,

Kaushik Solanki

orital81
Contributor III

Re: Convert YYYY-WW to Date

Here is one option (vWeek should be a date in YYYY-WW format):

MakeWeekDate(Left(vWeek,4),Right(vWeek,2))

Not applicable

Re: Convert YYYY-WW to Date

Thank you. I have one problem. Some fields are like this:

2013-2

instead of 2013-02.

Is there a way to exclude the '-' ?

Re: Convert YYYY-WW to Date

Hi,

     In that case you can try this.

     MakeWeekDate(left(Field,4),if(len(Field)=7,right(field,2),right(field,1)),0)

Regards,

Kaushik Solanki

 

Re: Convert YYYY-WW to Date

Hi, Tresosco,

    

     suggestion is not bad but num() will not work in this case, but num#() will work.

Regards,

Kaushik Solanki

orital81
Contributor III

Re: Convert YYYY-WW to Date

Yes there is:

MakeWeekDate(SubField('2013-02','-'),SubField('2013-02','-',2))

MVP
MVP

Re: Convert YYYY-WW to Date

Would be a negative week number:

MakeWeekDate(left('2013-2',4),Num#(right('2013-2',2)),0) => 10.12.2012

MVP
MVP

Re: Convert YYYY-WW to Date

, right .

Community Browser