Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

gregoryt40
New Contributor

Using Calendar Objects to Create Variables

Hello,


I am interested in having two calendar objects that would then create variables.  The goal of this is to compare fields across a set of dates.  Therefore, I would like the first calendar object to set the first date while the second creates another variable for the second date.

Any thoughts on how I could get this to work?

Thank you!

4 Replies
MVP & Luminary
MVP & Luminary

Re: Using Calendar Objects to Create Variables

You don't need to create variables for this. You need only two variables like vStart and vEnd and use them within your calendarbox (with min/max-date + date-formats). Then you have two options - one is to use an field-selection action triggered by changes on the variable and the other ist o use set analysis filter within your expressions like:

sum({< Date = {">='$(vStart)'<'$(vEnd)'"}>} AnyValue)

This is slightly different but I think it's helpful, too: Selecting Arbitrary Date Ranges - YouTube

- Marcus

gregoryt40
New Contributor

Re: Using Calendar Objects to Create Variables

Let's say I have a field "Year", which I use as my calendar selection field.

How do I use what is selected in each calendar object in an expression or as a field in a table I create?

gregoryt40
New Contributor

Re: Using Calendar Objects to Create Variables

In other words.  I want to select from  a set of dates in the calendar and have what ever date I select be a variable.

MVP & Luminary
MVP & Luminary

Re: Using Calendar Objects to Create Variables

I believe you are thinking this too complicated - qlikview has (regulary build) an associative datamodel by which all data are linked per key-fields. If you made a selection all available data are then included within the views and calculations (unless you used advanced techniques like alternate states or set analysis). A good starting point is this here: Get started with developing qlik datamodels

If you want to compare data against various time-periods then you should use a master-calendar and create flags for these periods, many examples to these topics could you find here: How to use - Master-Calendar and Date-Values.

- Marcus