[SOLVED] Getting the last 11 week data from the current week.
Hi! i have a week no field of size A2. and i want to caculate the last 11 week from the week no selected. when i am doing its showing some error. Can you please suggest some syntax to get the last 11 week data from the current or selected week.
I'm struck with this. Need help.
Thanks in advance.
ArpitaThis message has been edited. Last edited by: Kerry,
WebFOCUS 7.6 Windows, All Outputs
February 21, 2011, 07:39 AM
FrankDutch
Maybe posting some code of what you tried might help to better understand what you want.
The first thing that I see is you have a weeknumber field A2...why...calculating with strings is not easy. Second: we now live in week nr 8 or something like that. 11 weeks before this week is probably week nr 49 of the former year. So it would be better to not start with the real week number but with a smartdate field The actual date is 2011/02/21 11 weeks ago it was 2011/02/21 minus 7*11 days now use the proper formula to go to that date and then calc the week number for that date.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
February 21, 2011, 09:33 AM
Arpita
Hi frank, Thanks a lot for your reply. My case is like, i want to generate a report from the intranet. For that we are taking our data from a view. That View contain a week no and weekend date.
From the front end we have the user input.One is from date and to date.
Now, our requirement is to generate the report from the date selected in FROM DATE BOx to the last 11 weeks data.
Previously we were comparing the From date and To date with our weekend field.
Can you please suggest. what syntax should i use to extract 11 weeks data from the selected date. We can use either week no or weerkend date. As our view contain both fields. But in report it should contain in total 12 weeks data.
Thanks in advance. I really nmeed some help.
Thanks Arpita
WebFOCUS 7.6 Windows, All Outputs
February 21, 2011, 10:55 AM
FrankDutch
Arpita
what is the format of the weekend data is it like a date (20110220)
if you only have a week number you can calculate the fist of the day of a week by a formula suppose you have week nr 2 than the date is 2*7 =14 after the base day of the year (suppose 20110101) from that point back you can calculate the remainder weeks (11-2) = 9*7 days =63 so the beginning of your meassure period is 63 days before 20110101 and that brings you to 20101029. the last day of your messaure periode will be 20110114.
If you start in week 17 your first and last day will both be in the same year. In the formulas you hae to build in that restrictions.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
February 28, 2011, 02:46 AM
Arpita
Hi Frank, Thanks a lot for your reply. The format of weekend date is (YYMD). Is there any way by which we can calculate the last 11 Week's data with the help of the Weekend date. Can you Please Suggest. What syntax should i use to extract 11 weeks data from the selected date. At present we are using Weekend Date in our selection criteria.
But in report it should contain in total 12 weeks data.
Thanks in advance. Your advice will be very helpful.
Thanks Arpita
WebFOCUS 7.6 Windows, All Outputs
February 28, 2011, 05:03 AM
FrankDutch
Arpita
what is wrong with my former answer
if you do have the weekend date, let us say '20110227' (yesterday) you can calculate 12 weeks earlier by 12*7=84 days subtracting from that start date