Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare Two Periods

I have historical data and want compare two periods.

For a example from "01/01/2012" To "31/012/12" compare  this with "01/01/2013" To "31/12/2013"

I have a date field(call dated) in the table.

Please can anyone give me an simple example.

Thanks.

Bhupendra

3 Replies
Not applicable
Author

Bhupendra,

You will need to use set analysis. I have written a doc about it:

http://community.qlik.com/docs/DOC-4951

that can be helpfull to learn this difficult topic.

The 1st value in 2012:

sum({< Dated ={">=01/01/2012 <= 31/12/2012"} >} Sales)

The 2nd value in 2013:

sum({< Dated ={">=01/01/2013 <=31/12/2013"} >} Sales)

But you can also put the dates into variables that will change after some time.

Fabrice

Josh_Good
Employee
Employee

You want to consider creating a master calendar.  This will enable you to make your set analysis much simpler because you can compare just the years.

Re: Creating master calendar

The 1st value in 2012:

sum({< Year ={2012} >} Sales)

The 2nd value in 2013:

sum({< Year ={2013} >} Sales)

You could also get a bit more fancy and have the user select on a Year and automatically select the previous year for comparison:

Selected Year

sum(Sales)

Pervious Year:

Sum({<Year = {$(=Max(Year)-1))}>} Sales)

Another alternative would be to use Alternate States so the user could select on any date (or combinations of dates) and compare it to any other set of dates.

Alternate states - demo

Not applicable
Author

Josh,

YES, the master calendar would be far better. And I answered too close to the question (your solution is more powerfull to the user)

Using Alternate State can make the writing of the Set much more complex, especially if you there are many ListBoxes to choose values from.. But it gives the power to the user ...

Fabrice