Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
agdgn123
Not applicable

Set analysis for date range made of 2 date variables

Hi,

I have 2 variables set up as start and stop date named:

vStartDate

vEndDate

I want to set up a date range limitation via set analysis to be used on a chart so that the chart will only display data for the range between these 2 dates.

I managed to set up the vEndDate limit but i can't figure out how to add the second condition (vStartDate). Can you please help me with the syntax?

This is my set analysis with the EndDate condition which is working:

Sum({$<Date={"<$(vEndDate)"}>}Sales)

1 Solution

Accepted Solutions
swuehl
Not applicable

Re: Set analysis for date range made of 2 date variables

Try adding an equal sign in front of your vStartDate variable definition:

=Date(Addmonth(Today(),-1))

or

Sum({$<Date={">$(=Date(Addmonth(Today(),-1)))<$(vEndDate)"}>}Sales)


I assume, that your default date format is 'DD/MM/YYYY', otherwise add the date format to Date() function.

4 Replies
swuehl
Not applicable

Re: Set analysis for date range made of 2 date variables

Sum({$<Date={">$(vStartDate)<$(vEndDate)"}>}Sales)

agdgn123
Not applicable

Re: Set analysis for date range made of 2 date variables

Thanks Stefan but the syntax does not change the date range as I wanted it to.

Here are my variables:

I have a feeling this has to do with the way I defined the vStartDate...?

My table looks like the below. with the added set analysis expression It currently ends on 31/07/2017 but starts on 31/07/2016. I want it to start from a month before today's date (e.g. 20/12/2016)

swuehl
Not applicable

Re: Set analysis for date range made of 2 date variables

Try adding an equal sign in front of your vStartDate variable definition:

=Date(Addmonth(Today(),-1))

or

Sum({$<Date={">$(=Date(Addmonth(Today(),-1)))<$(vEndDate)"}>}Sales)


I assume, that your default date format is 'DD/MM/YYYY', otherwise add the date format to Date() function.

agdgn123
Not applicable

Re: Set analysis for date range made of 2 date variables

Thanks Stefan! Adding a "=" at the beginning of the variable did the trick!