Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing two different year ?

need to compare two different years ( 2011 and 2010) using variables.

Can any one help.

tnx

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

After taking line chart and adding Dimension and Expression

Dimension:-Month

Previous Year

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

And

Current Year

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

See the snap shot of the Line chart with the Month Dimension and Expression for current and previous

LineChartView.png

View solution in original post

20 Replies
MK_QSL
MVP
MVP

SUM({<Year = {'$(=Max(Year))'}>}Sales)                //Current Year

and

SUM({<Year = {'$(=Max(Year)-1)'}>}Sales)               // Previous Year

Now you can compare them

its_anandrjs
Champion III
Champion III

Write a variable like

let vCurrYear  = 2011

Let vPrevYear = 2010

and in expression use this variavbles

its_anandrjs
Champion III
Champion III

Update  now check

If you want to compare only 2011 and 2010

then write

2011

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

And

2010

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

Not applicable
Author

Thanks .

But i would like to depict them on line graphs ?

MK_QSL
MVP
MVP

Let us know your requirement with dummy data...

Not applicable
Author

Thanks

i was thinking just like this :

   http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/03/ytd

MK_QSL
MVP
MVP

Create a line chart

Dimension

Month

Expressions

SUM({<Year = {'$(=Max(Year))'}>}Sales)                //Current Year

SUM({<Year = {'$(=Max(Year)-1)'}>}Sales)             // Previous Year

tresesco
MVP
MVP

So, is there anything specific there in the blog that you don't understand? Otherwise, it explains very nicely, right?

its_anandrjs
Champion III
Champion III

You can make chart with any dimension like

Take a line chart

Dimension :-Year ,Month

Expression1:- for 2011

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

And

Expression2:- for 2010

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

If you want to plot chart for current year and previous year then use

Dimension:-Month

Previous Year

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

And

Current Year

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