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

Convert sql to qv-script


Hi all.

I need help to convert this sql to qv-script:

     Convert(integer,substring(Month,1,4) + substring (Month,6,7) ) as YearMonthNum,

Where "Month" looks like "2009-08".

Thanks in advance.

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

left(Month, 4)*100 + right(Month, 2) as YearMonthNum

Best,

Peter

View solution in original post

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

left(Month, 4)*100 + right(Month, 2) as YearMonthNum

Best,

Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Did it work?

If so, please mark an answer to close this discussion. That makes it easier for us to track unanswered questions. Thanks.

Peter

hic
Former Employee
Former Employee

I would instead use

Date(Date#(Month,'YYYY-MM'),'YYYY-MM')

Then you will get a proper dual value - a value with both a numeric (date serial number) and textual part.

HIC

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Date(Date#(Month, 'YYYY-MM'),'YYYY-MM')) AS

OR

=Date(MakeDate(Left(Month, 4), Right(Month, 2)), 'YYYY-MM')

Hope this helps you.

Regards,

Jagan.