Announcements
cancel
Showing results for
Did you mean:
Contributor II

## Date Filter

Hello everyone,

I need help with the creation of a date filter.

I want to create a filter with 3 options: all days until 30 days from today, all days until 60 days from today, and all days until 90 days from today.

I have a canonical table with the date column. To create the filter, I added the filter visualization and the code:

If ( DaysDifference<= 30, '30days',

If ( DaysDifference<= 60, '60days',

If ( DaysDifference<= 90, '90days' ) ) )

The problem is that when I select the 60 days filter, I get the information from 30-60 days and not all the dates before 60 days.

Do you know how to solve this?

Labels (1)
• ### General Question

1 Solution

Accepted Solutions
Champion III

with an above if () block one date can only be under one classfication

you need to create multiple fields , refer below example

Calendar:

Date,Month,Year,..........

,If ( DaysDifference<= 30, 1) as 30days

,If ( DaysDifference<= 60, 1) as 60days

,If ( DaysDifference<= 90, 1) as 90days

CrossTable(Period,PeriodVal,1)

Resident Calendar;

Then use the Period field as filter

refer below for more

Period Presets: Compare Periods on the fly - Qlik Community - 1486371

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
3 Replies
Master

hi may be this

If((DaysDifference<=30,'30 Days',

If((DaysDifference >30 and DaysDifference <=60,'60 Days' ,

If(DaysDifference >60 and DaysDifference <=90,'90 Days' ,'More than 90 days')))

Champion III

with an above if () block one date can only be under one classfication

you need to create multiple fields , refer below example

Calendar:

Date,Month,Year,..........

,If ( DaysDifference<= 30, 1) as 30days

,If ( DaysDifference<= 60, 1) as 60days

,If ( DaysDifference<= 90, 1) as 90days

CrossTable(Period,PeriodVal,1)

Resident Calendar;

Then use the Period field as filter

refer below for more

Period Presets: Compare Periods on the fly - Qlik Community - 1486371

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Contributor II
Author

Thank you Vinieme,

That was exatly what I was looking for. I had a bridge table in my example, so what I did was to add those three columns in my table and do a crosstable in that one so that I could have all the filters.