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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

get past year data

Hi,

when I selected 2014 in my year list box, I want to get the 2013 sales data. How can I do this in a chart expression?

Labels (1)
19 Replies
sunilkumarqv
Specialist II
Specialist II

Include 'Month= ' as well

Num(Sum({<Year={'$(=Max(Year)-1)'},Year=,Month=>}Retail_Sale_Qty),'#,##0') - prev year

Num(Sum(Retail_Sale_Qty),'#,##0') - selected year

Not applicable
Author

Hi sunil,

I can't neglect the month because I want december month sales data

sunilkumarqv
Specialist II
Specialist II

its not month restriction that intense to trigger will happen have try and let me no

Not applicable
Author

my problem is still the same

ashfaq_haseeb
Champion III
Champion III

HI,

did you try my solution?

If possible share sample app

Regards

ASHFAQ

Not applicable
Author

I tried, but no change

Not applicable
Author

Please find the attached QVW

marchoctober
Creator
Creator

Also simple way is using Only,

F.e. you select year 2014, there will be expression only(year)-1, that will handle it,

sum({<year={$(=Only(year))}>} Sales) //First expr that calculates selected year,

sum({<year={$(=Only(year)-1)}>} Sales) //Second expr that calculates year-1,

='Sales '&Only(year_sale) // First expr to label calculation for selected year,

='Sales '&(Only(year_sale)-1) // Second expr to lavel calculation for year-1,

For ease of use you can on general tab of chart properties identify Calculation condition, f.e. Count(DISTINCT year_sale)=1

This means, that chart will shown up only when you select needed (starting) year which will be the basis to count previous year.

Don't forget to set ERROR message that will helps the user choose the year, go to Error messages on General tab of chart properties, and further locate Calculation condition unfulfilled and set reminer for something like that: Please select sales year.

User will see the message in chart, further select the year 2015, and he will see results for 2015 and 2014, if he selects, f.e. 2013, he will see 2013 vs. 2012.

Hope it also will help.

jagan
Partner - Champion III
Partner - Champion III

Hi Dushan,

Try this expression

Sum({<Year={$(=(Max(Year)-1))},Month=,Quarter=, Week=, Date=>}value)


Replace Month,Quarter, Week, Date with corresponding fields in your dashboard.


Regards,

Jagan.

Not applicable
Author

thanks all