Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimensions using groups and how to limit values on x-axis based on chosen group?

Hi All,

I have a chart and in the properties --> Dimensions tab, i've created a cyclic group named Period.

This cyclic group uses 3 fields:

1. Day which contains date of month e.g. 01/01/2014, 02/01/2014 etc

1. Week which contains week of year e.g. 01/2014, 02/2014 till 52/2014 for number fo weeks existing in a year

3. Month which contains month of year e.g. Jan 2014, Feb 2014 till Dec 2014

I'd like to implement the following functionality in a chart and i'd be grataeful if you could please help

On the calendar, a user can select either a specific day or week or month.

On the chart If i choose dimension "Day", i'd like to display only the past 21 days of data including the current day which the user has selected.

On the chart If i choose dimension "Week", i'd like to display only the past 9 weeks of data including the current week which the user has selected

On the chart If i choose dimension "Month", i'd like to display only the past 4 months of data including the current month which the user has selected

3 Replies
arulsettu
Master III
Master III

can you post data source like excel

Not applicable
Author

Hi,

plz find attached example data

Anonymous
Not applicable
Author

you would use an if statement in your expression referencing your cyclic group.

I don't know if my set analysis is exactly right for your data but it would be something like this.

=if(getcurrentfield(Periodic)='DateField',sum({<[DateField]={'>=max([DateField])-21<=max(DateField)'}Stock),

     if(getcurrentfield(Periodic)='WeekName,sum({<[DateField]={'>=weekend(max([DateField]),-9)<=weekend(max(DateField))'}Stock),

       sum({<[DateField]={'>=addmonths(max(MonthName),-4)<=max(MonthName))'}Stock))