Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
kbautist
Contributor II
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?

Thank you in advance!

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
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)

Load Date,30days,60days,90days

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.

View solution in original post

3 Replies
brunobertels
Master
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'))) 

vinieme12
Champion III
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)

Load Date,30days,60days,90days

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.
kbautist
Contributor II
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.