Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
xarapre7
Creator II
Creator II

Convert Year Month and Week Begin Date from sql to load script

Can you please help me convert the 2 below sql scripts into load statements?

1)  Concat(CONVERT(VARCHAR,[Calendar Year]),iif(len(CONVERT(VARCHAR,[Calendar Month Number]))=            1,'0'+CONVERT(VARCHAR,[Calendar Month Number]),CONVERT(VARCHAR,[Calendar Month Number]))) AS YEAR_MONTH

2)  DATEADD(DAY, 2 - DATEPART(WEEKDAY, [Calendar Date]), [Calendar Date]) AS WEEK_BEGIN_DATE

 

Thank you in advance!

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

load ...

[Calendar Year]&num([Calendar Month Number],'00') as YEAR_MONTH,

 

// Assuming your week starts from Saturday. If it starts from other days then change the number highlighted in weekstart function.  Week Number starts from.. 0 -Mon

weekstart([Calendar Date],0,5) as WEEK_BEGIN_DATE

 

View solution in original post

2 Replies
Kushal_Chawda

load ...

[Calendar Year]&num([Calendar Month Number],'00') as YEAR_MONTH,

 

// Assuming your week starts from Saturday. If it starts from other days then change the number highlighted in weekstart function.  Week Number starts from.. 0 -Mon

weekstart([Calendar Date],0,5) as WEEK_BEGIN_DATE

 

View solution in original post

xarapre7
Creator II
Creator II
Author

Sorry for the late reply.  I was travelling. 

Thank you this Kush!  I appreciate your kind help.