Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Master III
Master III

Add 30, 60 & 90 day date filters based on Date feild

Hi Folks ,

Looking for something like below, from today() date last 30 , 60 and 90 days filter in list box.

0 to 30 ->30

0 to 60->60

0 to 90 ->90

Kindly help!

Thanks,

AS

13 Replies
Master III
Master III

Hi Ashok,

I did something like below , some cosmetic changes with 3 different list box and calling individual expressions:

30 ---=if(DaysDifference >= 0 and DaysDifference <=30, '30')

60---=if(DaysDifference >= 0 and DaysDifference <=60, '60')

90---=if( DaysDifference <=90, '90')

Thanks,

AS

Not applicable

Hi,

Thanks for your quick response.

But in my case i want to use as Dimension in my straight table.

like below

   

Time PeriodLoadsCost
Last 7 days1020
Last 14 days2040
Last 30 days50100
Last 12 months100200


If you any suggestions on same just let me know.        

Thanks,

Ashok.

Not applicable

Hi Amit,

I got the solution for above query. please see below steps.

1.Create inline table and it's a don't have any connection with other tables(Like Data iland)

LOAD * inline [

Bucket

0-7

0-14

0-30

];

2. Then take Bucket as a dimension in chart.

3. Write the expressions like below.

=if(Bucket='0-7' , Sum({<Date={">=$(=Date(Today()-7))<=$(=Today())"}>}Load),

if(Bucket='0-14' , Sum({<Date={">=$(=Date(Today()-14))<=$(=Today())"}>}Load),

if(Bucket='0-30' , Sum({<Date={">=$(=Date(Today()-30))<=$(=Today())"}>}Load),

)))

This will work in your scenario also. For more clarification i am attaching application as well.

Thanks,

Ashok.

Contributor III
Contributor III

Use the below code in the Load script,

If ( Date(Today()) - Date(Date_Field) ) <= 30, '30days',

If ( Date(Today()) - Date(Date_Field) ) <= 60, '60days',

If ( Date(Today()) - Date(Date_Field) ) <= 90, '90days' ) ) ) as Days_Filter