Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

How to calculate last four weeks data?

Hi All,

I am trying to calculate last four weeks data.

I have a date field and latest date available is 5/27/2018 and minimum date is 1/12/2017.

I converted the date filed into Year and Week format.

So max week is 5/27/2018  (i.e.  Week22) Format - 2018-W22

Min Week - 1/12/2017 (i.e.  Week52) Format - 2017-W52

Now I want to show last four weeks data. this is the order of last four weeks.

1. 5/27/2018 - W22 (2018-W22)

2. 5/20 - 5/26 - W21

3. 5/13 - 5/19 - W20

4. 5/6 - 5/12 - W19

Can someone help me in getting data for 4 weeks?

I am able to get max week using the formula:

=Max(Year([Created date])&Week([Created date])) - Output - 201822

I am trying to find the way to get W19 (201819)

1 Solution

Accepted Solutions
Highlighted
Creator III
Creator III

Hi Mayank,

Thanks for your response. I got it working. I calculated max date and then took weekend value as max value and then subtracted 28 days from it.

Cheers,

Varun

View solution in original post

4 Replies
Highlighted
Specialist
Specialist

Just try

=Max(Year()&Week(),-4 )

Regards,

Mayank

Highlighted
Creator III
Creator III

Hi Mayank,

It is still giving the maximum year and week.

Regards,

Varun

Highlighted
Specialist
Specialist

Please share your application here...So that i can look into it.

Regards,

Mayank

Highlighted
Creator III
Creator III

Hi Mayank,

Thanks for your response. I got it working. I calculated max date and then took weekend value as max value and then subtracted 28 days from it.

Cheers,

Varun

View solution in original post