Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
shree909
Partner - Specialist II
Partner - Specialist II

Caluculation of weeks with dates

Hi,

i have calendar date and for every month and  i want to calcualte the weeks ..

for that i used the below expression to 

'Week-'&(1+ ceil((K_DATE-FLOOR(WEEKEND(MONTHSTART(K_DATE),0,-1)))/7)) AS Week,  this works fine  and show

Week1, week2 ,week3, week4, week5,

now the issue i have is instead of week1 i want to show the  dates i.e. starting date and end date of that week.. for every particular month...

and also i want to exclude weekends ..

so i used this

'Week Of  ' &

Date((WeekStart(K_DATE)),'MM/DD') &'-'& Date((WeekEnd(K_DATE)),'MM/DD') AS Weekof,  this works fine but i in the weekend  function i want to calculate the end date of the week  say friday..

Any help would be really Appreciates..

Thanks

3 Replies
Not applicable

The trouble is that your weeks are not linked to the dates, like on a table. On an application likes yours i had to create a qvd that contains thats parameters then i just charge the data from qvd and show the way you want.

shree909
Partner - Specialist II
Partner - Specialist II
Author

Hi  thanks for the reply ,

i have all the dates   from that date i want to calcuate year, month , week that works

from those dates i want to  create a week in suach a way its show the end date and start date of that week instead of   week1  , wee ( week start date , week end date)

CELAMBARASAN
Partner - Champion
Partner - Champion

'Week Of  ' &

Date((WeekStart(K_DATE)),'MM/DD') &'-'& Date((WeekEnd(K_DATE) - 2),'MM/DD') AS Weekof

I used 2 here by considering week end date as sunday. For you it is saturday then it will be 1