6 Replies Latest reply: Sep 4, 2017 12:02 AM by susant Kumar swain RSS

    Generating week numbers for the last 10 weeks.

    qlik tech

      Hi,

       

      I have a query that is dependent on 3 variables, this is look at the sales thats happening in the last 35 days.

      the query is

       

      select

           *

      from

           sales

      where

           week_number = Previous week number

           and agent_sale_Date between variable1 (last saturday) and variable2(last saturday - 35)

       

      I need to do the same going back 10 weeks!!

       

      I would need to generate the week numbers from last week going back 10 weeks. I need to run this on a Monday, so the other 2 variables I can hard code or use an inline table I think. How do we generate the week numbers, and also is there a way to do variable 2 and 3 on the fly? many thanks for your help

       

      variable 2  variable 3

      2                     35

      9                      42