Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bushpalaamarnat
Creator
Creator

Creating back end table

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.

7 Replies
olivierrobin
Specialist III
Specialist III

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
MVP
MVP

You can use below in script.

Week(Date) as [Week No]

bushpalaamarnat
Creator
Creator
Author

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
Specialist III
Specialist III

apply the function to your date column

bushpalaamarnat
Creator
Creator
Author

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
MVP
MVP

Provide input data as sample file

output data as per your requirement

petter
Partner - Champion III
Partner - Champion III

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