Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i need to find min and max dates for current week
LET vCW = peek('CYW',0,'table1');
LET vMinCurrentWk = (WeekStart($(vCW))));
LET vMaxCurrentWk = WeekDay(WeekEnd($(vCW)));
please help
vCW is returning current yearweek. No issue with this. But need to find min and max of current week.
this will work only for 201628
Yes, I wrote in my post
Replace 201628 with your field or variable
I wan the Min date to start from Sunday, and Max date to be Saturday.
swuehl already answered (subtract 1 or redefine the week start)
Thankyou....and Also, within the script, how to calculate a metric for (current week + next 3 weeks) data -> next 3 weeks should be updated everyday. Please help
Thankyou. Calendar is not same as system calendar. Also, within the script, how to calculate a metric for (current week + next 3 weeks) data -> next 3 weeks should be updated everyday. Please help
can you post a sample?
I am done with the current week part. I need to get next part.
I need to calculate a Dmnd metric for (current week+ next two weeks)
Current week demnd is snapshot of current week
next two weeks demnd have to be updated everyday
for current week demnd 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
I need to calculate a Dmnd metric for (current week+ next two weeks)
Current week demnd is snapshot of current week
next two weeks demnd have to be updated everyday
for current week demnd 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
I need to calculate a Dmnd metric for (current week+ next two weeks)
Current week demnd is snapshot of current week
next two weeks demnd have to be updated everyday
for current week demnd 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 you please help me with this
Could you please help me with this