Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mdmukramali
Specialist III
Specialist III

Week starting from Saturday

Dear Community,

My issue is that the qlikview default week is Monday-Sunday , and i need the weeks to be starting from Saturday-Friday.

for example , if i select 2013, week 30 in my calender i would want to see the dates form 20th - 26th June.

i tried by using

If(WeekDay(Date) = 6, Week(Date) +1, Week(Date)) AS NewWeek,

but i'm getting weekstart from Sunday-Saturday.

but i need from saturday to friday.

i'm attaching the sample apps kindly find the attachment.

thanks,

Mukram.

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

Let vMin = num(MakeDate(2012,01,01));
Let vMax = num(MakeDate(2012,12,21));

Load Date($(vMin) + RowNo() -1) as DATE,
  WeekDay(Date($(vMin) + RowNo() -1)) as WEEKDAY,
  if(num(WeekDay(Date($(vMin) + RowNo() -1)))>=4,num(WeekDay(Date($(vMin) + RowNo() -1)))-3 ,

     NUm(WeekDay(Date($(vMin) + RowNo() -1)))+4) as WEEK_NUM
AutoGenerate 1
while Date($(vMin) + RowNo() -1) < Date($(vMax));

Regards,

Kaushik Solanki

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

Dear kaushik Solanki,

thanks for Quick response.

But from your solutions still i'm getting the result which i'm expecting.

when i select the Week 30 then it's selected 07/22/2013 to 07/28/2013.

i need the dates from 07/20/2013 to 07/26/2013.

Thanks,

Mukram.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Let vMin = num(MakeDate(2013,01,01));
Let vMax = num(MakeDate(2013,12,21));

Load Date($(vMin) + RowNo() -1) as DATE,
     if(num(Weekday(Date($(vMin) + RowNo() -1)))>=5,Week(Date($(vMin) + RowNo() -1))+1,Week(Date($(vMin) + RowNo() -1))) as WEEK
AutoGenerate 1
while Date($(vMin) + RowNo() -1) < Date($(vMax));

Regards,

Kaushik Solanki

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

Dear kaushik Solanki,

Thanks for your help.

i make small change in script it's working as per my requirement.

Like

If(WeekDay(Date) >= 5, Week(Date) +1, Week(Date)) AS NewWeek,

Thanks,

Mukram.


kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Its cool.

Regards,

Kaushik Solanki

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