Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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?

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

 

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

View solution in original post

12 Replies
tresesco
MVP
MVP

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.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
orital81
Partner - Creator III
Partner - Creator III

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

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

Not applicable
Author

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

2013-2

instead of 2013-02.

Is there a way to exclude the '-' ?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, Tresosco,

    

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

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
orital81
Partner - Creator III
Partner - Creator III

Yes there is:

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

rbecher
MVP
MVP

Would be a negative week number:

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

Astrato.io Head of R&D
tresesco
MVP
MVP

, right .