Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

deepanshu_chamo1
New Contributor

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

Tags (1)
11 Replies
MVP
MVP

Re: Filter only 4 weeks

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?

deepanshu_chamo1
New Contributor

Re: Filter only 4 weeks

Thanks for the reply.

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

Please suggest.

Thanks

Deepanshu

Re: Filter only 4 weeks

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

reddys310
Honored Contributor II

Re: Filter only 4 weeks

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
Valued Contributor

Re: Filter only 4 weeks

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

Re: Filter only 4 weeks

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

deepanshu_chamo1
New Contributor

Re: Filter only 4 weeks

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

Re: Filter only 4 weeks

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

- Marcus

deepanshu_chamo1
New Contributor

Re: Filter only 4 weeks

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