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

How to display previous year value in year wise line chart ?

Hello All ,

I am working on sales dashboard where it need to display previous year value in line chart where dimension is year.

Below is data which used to build the chart

Saleyear Saleqty

2007       100

2008       150

2009       180

2010       190

2011       175

2012       125

I have tried with set analysis but didn't work.

13 Replies
Not applicable
Author

Hi,

If you take dimension as year and expression as salesqty then the line chart will show the data for all the years.. if you want to show only previous year value then use calculated dimension..

=max(year)-1

or based on selections you want show data for previous years means you have to create on variable and use that in calculated dimension..

=$(vyear)-1

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find attached file.

Hope it helps you.

Regards,

Jagan.

Not applicable
Author

As ur Requirement U want to display the data like below ryt?

Saleyear Saleqty

2007       -

2008       100

2009       150

2010       180

2011       190

2012       175

~ Kabilan K

er_mohit
Master II
Master II

use this expression

sum({$<saleyear={$(#=only(Saleyear)-1)}>}Saleqty)

hope it helps you

Not applicable
Author

hi

try according to this,

Examples:

sum( {$<Year = {$(#vLastYear)}>} Sales )
returns the sales for the previous year in relation to current selection. Here, a variable vLastYear containing the relevant year is used in a dollar-sign expansion.

sum( {$<Year = {$(#=Only(Year)-1)}>} Sales )
returns the sales for the previous year in relation to current selection. Here, a dollar-sign expansion is used to calculate previous year.

hope it helps you.

nirav_bhimani
Partner - Specialist
Partner - Specialist

Hi,

Try this.

For Current Year:

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

Last Year Sales:

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

2 Year Back

Sum({<Year= {"$(=Max(Year)-2)"},Quarter=,Year=>}Sales)

Regards,

Nirav Bhimani

Not applicable
Author

I have tried this one still it is showing output as per below data
SaleyearSaleqtyLY Qty
2007100100
2008150150
2009180180
2010190190
2011175175
2012125125
Please see attached file and help me on this.
Not applicable
Author

didn' work for me .

Please see below I have given to Nirav Bhimani

Not applicable
Author

didn't work . Please see reply given by me to Nirav Bhimani