Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
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

20 Replies
Not applicable
Author

I have used :

SUM({<Year = {'$(=Max(Year)-3)'}>}Sales)                //2011

SUM({<Year = {'$(=Max(Year)-4)'}>}Sales)             // 2014

The problem is that, i can not see both lines graphs  at the same time for comparison.

MK_QSL
MVP
MVP

Keep Month as Dimension

Not applicable
Author

You are right for  the st expression.

but why can not i see comparison graph like this : (I can not see it )

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

its_anandrjs

Exactly you not get it depends on the value in the fields in your model like month and Year values. Also after creating line chart format the line chart like click on the expression >> Display options >> Select Smooth from the options.

SunilChauhan
Champion II
Champion II

You need to take Monthyear Inpace of month then it will look like graph

Create monthYear field

MonthName(Date) as MonthYear and take as dimension

use same expressions as provided above posts

hope this helps

Sunil Chauhan
its_anandrjs

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

SunilChauhan
Champion II
Champion II

No need to take two expression

simply Take month and year in dimension

and  expression

sum({<Year={'2010','2011'}>} Amount)

hope this helps

Sunil Chauhan
SunilChauhan
Champion II
Champion II

even expression

sum({<Year={'2010','2011'}>} Amount)


can be dynamic

like below

sum({<Year={">=$(=Max(Year))"}>}Amount)

this helps you to compare current Year Vs previous Year

hope this helps

Sunil Chauhan
Not applicable
Author

Thanks a lot.

It worked very well

MK_QSL
MVP
MVP

The same answer I have given long time ago !!