Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (1)
3 Replies

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

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

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

Please see the attached file.

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

Not applicable

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

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

Community Browser