Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

two different time periods in one line graph (like google analytics)

Hi,

I would like to be able to compare two different time periods in one line graph. Periods should by fully customizable. For example: comparing 15-20 April 2010 with 16-21 April 2011.

Google Analytics has this functionality, see http://www.appliedanalytics.org/google-analytics-compare-data-different-time-periods/

Can this functionality be tweaked in QV?

Thanks in advance!

Regards,

Robin

7 Replies
johnw
Champion III
Champion III

Hmmm, I'm not thinking of a simple and direct way, particularly if the time periods can overlap, which I'd think would be desirable in the general case.

I'm guessing that you could have the user select the first time period by whatever means you normally select time periods in your application.  Hit a button that saves the data to a bookmark.  Then have them select the data to compare to.  In the chart, you'll have two expressions.  If, say, you're comparing sales, the first would just be sum(Sales).  The second would use set analysis to look at the bookmarked data set instead of the current data set, like sum({BM01} Sales).

I haven't tried it, and I'm not sure how well it works in practice.  But on paper, it seems like it would do the trick.

It's even more flexible than just comparing date ranges, though.  You can use the exact same mechanism to, say, compare two different customers.  It's really just comparing one data set to another data set, with the user in full control over the contents of the two data sets.

mike_garcia
Luminary Alumni
Luminary Alumni

I think there is no direct way to overlap values corresponding to two different time periods in a chart where the dimension is also a time field. The reason for this is that one point value in the time-related x axis can only hold one time-related data point.

On the other hand, if either the x axis or the data set you use to evaluate the expression, is non-time-related, there would be no problem, as in the case of comparing two different customers over a period of time.

I had a similar requirement in which the customer wanted to compare the trend over the course of the current month versus previous month and same month last year, and he wanted a chart that is not available on QlikView out of the box (one with a bar, a line, and area). So, I overlapped two charts, a combo chart for the bar and line, and a line chart on the back for the area. This is a snapshot.

Overlapped.PNG

In this case, the x-dimension is "Day", which is a Field that is available for all three months and is not exclusive for just one of them. If, in your case, you were to use a "common" dimension for the two periods you want to compare, I think you would have no problem. However, if you want to use a Date Field (exclusive) as Dimension, you should overlap two charts, each playing with a different data set.

If you want to go for this option, be careful to maintain the same scale between them, so that they could actually be compared. To achieve this, I used something like:

RangeMax(Max(Aggr(expression_Month1, Date)),

                Max(Aggr(expression_Month2, Date)),

                Max(Aggr(expression_Month3, Date)))

Place that in the Static Max Field on both charts and you are set.

Also, set the top chart with a transparent background so that the back chart can be seen.

Hope this helps.

Mike.

Miguel García
Qlik Expert, Author and Trainer
Not applicable
Author

@John & @Mike,

Thanks so much for your quick reply, i am going to try both your solutions.

I am a newbie at qv, only using it since this month. The thought i was playing with, was to add a ranking to both date ranges and somehow join the two ranges on the rankings. Did not get that to work though...

Regards,

Robin

Anonymous
Not applicable
Author

Hello,

I've found a way, if you want, you can see here:

http://bit.ly/1PQZ0Wj

Best Regards,

PriyankaShivhare
Creator II
Creator II

Hi,

Can you send the link again..i am not able to see the probable solution for this

pauljohansson
Creator III
Creator III

Do you have a link or an example solution?

 

br

Paul

PriyankaShivhare
Creator II
Creator II

Check the attached qvf ..

i have found this qvf  in the community and figured out the solution using As Of Calendar.

 

 

Thanks,

Priyanka