Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to calculate a metric for (current week+ next two weeks)
Current week dmnd is snapshot of current week
next two weeks dmnd have to be updated everyday
for current week dmnd I tried to restrict the "where" condition as below
CWkdata:
NoConcatenate
LOAD
mat_key,
TODAY() as cal_key,
Sum( dd) as Dmnd // this is the metric
FROM
abcd.QVD (qvd)
Where
wkbeg >= $(vMinCurrentWk)
wkend <= $(vMaxCurrentWk)
Group By
mat_key, TODAY();
I have created two tables for and next week and the next to next week as below
// | Next Week |
Caltable:
NoConcatenate | |
LOAD DISTINCT | |
YRWK | |
FROM calendr.QVD (qvd) | |
Where CALDT = Today() + 7 | |
; |
W1:
NoConcatenate | ||
LOAD | ||
YRWK as Yw1 | ||
Resident Caltable | ||
Order By | ||
YWK | ||
; |
LET vW1 = peek('Yw1',0,'W1'); // this is calculating next week , i.e '201629'
DROP Table Caltable;
// | 2 Weeks |
Caltable:
NoConcatenate | |
LOAD DISTINCT | |
YRWK | |
FROM calendr (qvd) | |
Where CALDT = Today() + 21; | |
W2:
NoConcatenate
LOAD
YRWK as Yw2
Resident Caltable
Order By
YRWK;
LET vW2 = peek('Yw2',0,'W2'); // this is calculating next week , i.e '201631'
DROP Table Caltable;
how to calculate next 2 weeks demnd to have to be updated everyday?
Please help
Could someone please help me with this
if current week is today()
week1 = today()+7
Then , week2 = today()+14 Right ?
Yes... I wrote the 3rd week earlier... Please consider as today()+14
You can use Weekname(today()) for current week
and weekname(today(),2) for the next two weeks
Question- What is meant by current week+next 2 weeks data ?
Why cant we call this as 3 weeks instead ?
I simply meant,
for eg: If today's week is 23
weekname(today(),2) will return 25.
Where current week snapshot is taken on monday and next two weeks should update everyday
Please help
Is the data available for the next two weeks or should they be forecasted?
I'm not very sure,
But you can try this in your code
wkbeg >= $(vMinCurrentWk) i.e weekStart(today())
wkend <= $(vMaxCurrentWk) i.e weekEnd(Weekname(today(),2))