Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist
Specialist

Set analysis to use only some weeks

Hi all,

I´m using the next expression to only show the last 5 weeks, when I select  a date.

=Sum({<Date={">=$(=WeekStart(Max(Date)-28))<=$(=Max(Date))"}>}Sales)

But now, I only need to see weeks that are in the same month that selected date.

My Date field its like:

...

16/05/2016

23/05/2016

30/05/2016

...

Thank you in advance

1 Solution

Accepted Solutions
Highlighted
Specialist
Specialist

Thank you stalwar1 and tresesco,

Finnaly the correct answer was:

=Sum({<Datefield={">=$(=MonthStart(Weekstart(datefield)))<=$(=Max(Datefield))"}>}[Sales)

With this expressión my chart only show weeks that are in month selected in date field.

In order words, if I select Datefield = 30/05/2016. My chart show only 5 weeks; and all of this weeks, Monday it´s in May.

Little bit strange but correct to my requirement.

View solution in original post

3 Replies
Highlighted
MVP
MVP

May be like:

=Sum({<Date={">=$(=WeekStart(MonthStart(Max(Date))))<=$(=Date(Max(Date)))"}>}Sales)

Highlighted

Or may be this:

=Sum({<Date={">=$(=Date(WeekStart(Max(Date)-28), 'DD/MM/YYYY'))<=$(=Date(Max(Date), 'DD/MM/YYYY'))"}>}Sales)

Highlighted
Specialist
Specialist

Thank you stalwar1 and tresesco,

Finnaly the correct answer was:

=Sum({<Datefield={">=$(=MonthStart(Weekstart(datefield)))<=$(=Max(Datefield))"}>}[Sales)

With this expressión my chart only show weeks that are in month selected in date field.

In order words, if I select Datefield = 30/05/2016. My chart show only 5 weeks; and all of this weeks, Monday it´s in May.

Little bit strange but correct to my requirement.

View solution in original post