Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 bushpalaamarnat
		
			bushpalaamarnat
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello All,
Could you please, based on today's date need to calculate current week , current week -6 and current week + 13.
attaching the out put in the excel file. Also, this need's to be created in back end and store automatically.
Any suggestion, please let me know.
 
					
				
		
 olivierrobin
		
			olivierrobin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hello
you can use the week function week(date)
so week(today()) for the current week
week(today()-6) for past 6
and week(today()+13) for 13 days in the future
 MK_QSL
		
			MK_QSL
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You can use below in script.
Week(Date) as [Week No]
 bushpalaamarnat
		
			bushpalaamarnat
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Sir, is there a better way to write, Week(today()-6), Week(today()-5) and so on..
for each week number i need to create a formula.
Regards,
Neelima.
 
					
				
		
 olivierrobin
		
			olivierrobin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		apply the function to your date column
 bushpalaamarnat
		
			bushpalaamarnat
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You can use below in script.
Week(Date) as [Week No]
This make sense, there is no date column we have to create date column based on today's date.
 MK_QSL
		
			MK_QSL
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Provide input data as sample file
output data as per your requirement
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This is the script I would recommend for you:
LOAD
S.No,
Date,
[Week No],
Week,
[Week Representation],
Dual('W' & If( RelWeek >= 0 , RelWeek+1 , RelWeek), RelWeek) AS [Week Labels];
LOAD
S.No,
Date,
Week(Date) AS [Week No],
'W'&Week(Date)&'-'&Right(Year(Date),2) AS Week,
If( Week(Date) = Week(Today(1)) , 'Current', If( Week(Date) < Week(Today(1)) , 'History' , 'Future')) AS [Week Representation],
(Week(Date)-Week(Today(1))) AS RelWeek,
'W' & (Week(Date)-Week(Today(1))) AS [Week Labels]
FROM
(ooxml, embedded labels, table is Sheet1)
WHERE IsNum(S.No); // Necessary for the Excel file you provided
I used the Dual function in QlikView to create a single field with both a text label and a numeric value as you can see in the last two columns:
![2018-04-19 12_25_40-QlikView x64 Personal Edition - [C__Users_Bruker_Documents_Weeks.qvw_].png](/legacyfs/online/200196_2018-04-19 12_25_40-QlikView x64 Personal Edition - [C__Users_Bruker_Documents_Weeks.qvw_].png)
