Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filter only 4 weeks

Kindly guide me in below logic. Is it possible to implement it or not?. If yes please help me

In the dashboard, I want to show only four weeks based on the below situations

1. The Week first day is Friday and last day is Thursday

2. In the dimension there will be and only four weeks For E.g.

Scenario for this week:

12/25 - 12/31 - 1 Week

1/1 - 1/7 - 2 Week

1/8 - 1/14 - 3 Week

1/15 - 1/21 - 4 Week

Next Week Scenario:

1/1 - 1/7 - 1 Week

1/8  - 1/14 - 2 Week

1/15 - 1/21 - 3 Week

1/22 - 1/28 - 4 Week

And same goes on.. The current week goes to 4 Week and basis of that the last 3 week calculate

Thanks a lot for your help. Really appreciate it

Thanks

Deepanshu

11 Replies
sunny_talwar

The goal is to completely restrict the data for last 4 weeks in the script or are you trying to do this in the chart object?

Anonymous
Not applicable
Author

Thanks for the reply.

I want to do it in dimension(Filter) and measure (charts) not in the script

Please suggest.

Thanks

Deepanshu

marcus_sommer

I wouldn't say that it couldn't be done within the gui but I recommend to use the script to create these filter-dimensions.

One method could be to use an AsOfTable like described here: Calculating rolling n-period totals, averages or other aggregations and another to create your week-logic within a master-calendar and using of a week-counter (per peek() or autonumber() within the master-calendar) for this field - and then you could use a quite simple set analysis like: sum({< WeekCounter = {">=$(=max(WeekCounter)-4)"}>} YourValues). More valuable informations about master-calendars could you find here: How to use - Master-Calendar and Date-Values.

- Marcus

reddy-s
Master II
Master II

Hi Deepanshu,

If you are looking to display only a fixed number of records make use of the limitations dropdown in the properties pane

2016-01-25+01_15_51-Qlik+Sense+Desktop.png

Thanks,

Sangram

paul_scotchford
Specialist
Specialist

I agree with Marcus and setup a good master calendar.

A well thought out master calendar for your enterprise is going to be a big asset and make these types of

calculations very easy.

Not applicable
Author

You could look into the WeekStart function

http://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/Scripting/DateAndTimeFunction...

It allows you to set the day of week as the week start day, as well as an offset

e.g. WeekStart(Today(),-4,4) = 25/12/2015

Combined with Set Analysis, should let you filter down to the last four weeks

Anonymous
Not applicable
Author

Thanks Marcus for the help!!

I do this but stuck again:

LetvStartweek = WeekStart(Today(),-1,4);//Generate Friday of Previous week

Let vEndweek = WeekStart(Today(),0,3);//Generate Thursday of Current Week

can you please guide me how to combine these and name as Week 4. Also, how to calculate the previous three weeks on the basis of 4th Week in just one go in Master Calender.

Please guide me

Thanks

Deepanshu

marcus_sommer

Have a look to these new document: Fiscal Calendar with Non-Standard Days (Not 1-31)

- Marcus

Anonymous
Not applicable
Author

Thanks sir!!

I tried it but may be very new to Qlik Sense. I am unable to put the above logic.

KIndly guide me the steps. It will be grateful for me.

Thanks in advance  for your valuable time!!

Deepanshu