Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using variables to create date range in set analysis

I am currently trying to create a date range filter in QlikSense using set analysis and the qsVariable extension, however I am having trouble in getting this to work.

Initially I was trying:

Sum({$<

        [PP.PaymentReceivedDate.autoCalendar.Date]>={$(vFrom)},

        [PP.PaymentReceivedDate.autoCalendar.Date]<={$(vTo)},

    StatusFlagCode = {$(vStatusFlag)}

>}[PP.ReceivedAmount])

This seemed fairly logical to me, but returned zero results. After some investigation it was suggested that I try the following:

Sum({$<

        [PP.PaymentReceivedDate.autoCalendar.Date]={'>=$(=vFrom)'},

        [PP.PaymentReceivedDate.autoCalendar.Date]={'<=$(=vTo)'},

    StatusFlagCode = {$(vStatusFlag)}

>}[PP.ReceivedAmount])

Unfortunately this also does not work, and it appears that the variable is not recognized within, as it in enclosed within quotation marks:

QlikSetAnalysis.JPG

Any suggestions would be appreciated!

James

1 Reply
Not applicable
Author

So it looks like the following works in this situation:

[PP.PaymentReceivedDate.autoCalendar.Date]={"$(= '>=' & date(vFrom) & '<=' & date(vTo))"},

The script editor still doesn't highlight the variables here, but it works in practice!