Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mrichman
New Contributor III

How to auto filter calendar for last 7 days or x days?

Hi Qlikview community!

Would be nice if you could help.

I would like to use the trigger function to automatically filter my calendar on the last 7 or x days? The field name of my calendar is Date.

Thanks in advance.

6 Replies
mikaelsc
Contributor III

Re: How to auto filter calendar for last 7 days or x days?

cleaner approach? Use a master calendar and use set analysis in your expressions?

sum({<Date={">=$(=max(Date)-x)"}>}Sales)

mrichman
New Contributor III

Re: How to auto filter calendar for last 7 days or x days?

Hi Mikael,

Thanks for the prompt reply and recommendation. However I'm really requiring the trigger on 'Select in Field' and automatically filtering it to the last 7 or x days. If you can help me, then that would be great

Thanks in advance!

mikaelsc
Contributor III

Re: How to auto filter calendar for last 7 days or x days?

Set trigger to select multiple values in a field from a variable

so i guess you could define a selectVariable containing the concatenated values you want.

those concatenated values could be variables themselves (max date -1;-2;-3;...)

not tested myself yet. just imagining...

MVP
MVP

Re: How to auto filter calendar for last 7 days or x days?

Often relative date fields are very helpful in situations like this.

You can create a field called DaysAgo in your load script and then simply do this:

Sum( {<DaysAgo={"<7"}>} Sales )

If you have a data island table with a field called #DaysAgo with the values 1 to 7 that your users can select from in tha filterpane you can have this measure:

Sum( {<DaysAgo={"<$(=Max(#DaysAgo))"}>} Sales )

Data Island Table: A table not having any key that connects it to any field in your normal data model.

DAYSAGO:

LOAD IterNo() AS #DaysAgo AUTOGENERATE 7;

The #DaysAgo field will act as your "trigger" to let the user select how many days they want to include in their analysis.

MVP
MVP

Re: How to auto filter calendar for last 7 days or x days?

Look at the attachment

When you click on the numdays field, the trigger (menù --> settiings  --> document properties --> triggers)

filters the dates on the d field.

The expression for the search string is

='(' & '"' & concat(DISTINCT {$ <d={">=$(=date(Today()-max(numdays)+1))<=$(=date(Today()-0))"}>} d, '"' & '|' & '"') & '"' & ')' 

For numdays = 7

     ("07/05/2018"|"08/05/2018"|"09/05/2018"|"10/05/2018"|"11/05/2018"|"12/05/2018"|"13/05/2018")

seven days including today

1.png

MVP
MVP

Re: How to auto filter calendar for last 7 days or x days?

another option is

Relative Calendar Fields

Community Browser