Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I have 5 Years data, i want to show current year and previous years.

Hi friend,

Can you please explain the query.

Thanks&Regards

Ramesh

3 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Probably in your chart you have year as dimension,

if yes then write in place of year (calculated dimension)

=If(year >= year(today())-1, year, null())

anc check the box "Suppress when value is null"

Let me know

Kushal_Chawda

Please see the attached file.

Select any Year and it will dynamically calculate the Current Vs Previous Year data

Not applicable
Author

Hi Rameshchetu

If we want to compare current year sale with previous year, previous year sales should reflect values in relation to current selection of year. For example if current selection of year is 2012, previous year should be 2011 and for current selection of year 2013, previous year is 2012.


therefore  try, '=Sum({$<Year = {$(Max(Year)-1)}>} Sales)' this will return sales for the previous year, alternatively, you can do this

'=sum({<Year={$(=Max(Year))},Company_Name=P({<Year={$(=Max(Year)-1)}>}Company_Name)>}Sale)', which should return sales with respective company names who made sales in the current year and previous year.

Hope this helps

Best Regards

Dlamini