Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

New Contributor

Specifying Data to be Displayed when Button is Pressed

Hey everyone! 

SQL-Heavy user here, trying to use this janked up syntax thing of a program y'all call QlikView.  I have a chart which displays information regarding users for a Salesforce-like database.  I have a column with their last login date.  I also have a column where it calculates DAYS SINCE LAST LOGIN.  It ranges from 0 to 900.  

>>> I'm trying to create buttons on the left/selection side that when clicked display just users with <30 days, as well as 31-60 days, and 61+ days.  It doesn't have to be buttons it can be anything!  I just don't know how to specify the syntax or anything.  To get the DAYS SINCE LAST LOGIN calculation, it's 

= Round(Today()-[Last Login])

Help me make these buttons!!!   The syntax QV uses for expressions is beyond wild!  

1 Reply
MVP & Luminary
MVP & Luminary

Re: Specifying Data to be Displayed when Button is Pressed

Welcome to the QlikView world. Easiest and most powerful approach is create a new field in the data when loading. 

=Round(Today()-[Last Login]) as [Days Since Last Login]

You can then create a listbox on the sheet with field [Days Since Last Login] and the user can select whatever values they want, including using expressions like >31 when they make the selection. 

If you want to provide a grouped field like "<30", "30-60" and so on, use an if() function in the script like so:

if(Today()-[Last Login]) >60, '61+ days'
,if(Today()-[Last Login]) >30, '31-60+ days'
,'<30 days')) as  [Days Since Last Login]