Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 qvqfqlik
		
			qvqfqlik
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 qvqfqlik
		
			qvqfqlik
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Could someone please help me with this
 
					
				
		
 varshavig12
		
			varshavig12
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		if current week is today()
week1 = today()+7
Then , week2 = today()+14 Right ?
 qvqfqlik
		
			qvqfqlik
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Yes... I wrote the 3rd week earlier... Please consider as today()+14
 
					
				
		
 varshavig12
		
			varshavig12
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You can use Weekname(today()) for current week
and weekname(today(),2) for the next two weeks
 qvqfqlik
		
			qvqfqlik
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Question- What is meant by current week+next 2 weeks data ?
Why cant we call this as 3 weeks instead ?
 
					
				
		
 varshavig12
		
			varshavig12
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I simply meant,
for eg: If today's week is 23
weekname(today(),2) will return 25.
 qvqfqlik
		
			qvqfqlik
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Where current week snapshot is taken on monday and next two weeks should update everyday
Please help
 
					
				
		
 vinieme12
		
			vinieme12
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Is the data available for the next two weeks or should they be forecasted?
 
					
				
		
 varshavig12
		
			varshavig12
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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))
