Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Comparison between current year and previous year

Hi All,

I want to calculate from transaction data:

1> count of CODE which are present in current year but not in previous year i.e New Code.

2> count of CODE which are present in previous year but not in current year i.e Lost Code.

3> count of CODE which are present in both years.

Any help would be highly appreciated.

Kindly find the application for dummy data.

1 Reply
MVP
MVP

Re: Comparison between current year and previous year

='In Both Year : '&COUNT({<year = {'$(=Max(year))'}, CODE = P({1<year = {'$(=max(year)-1)'}>}CODE)>}DISTINCT CODE)

='In '&Max(year) & ' but Not '&(Max(year)-1) &': '&COUNT({<year = {'$(=Max(year))'}, CODE = E({1<year = {'$(=max(year)-1)'}>}CODE)>}DISTINCT CODE)

='In '&(Max(year)-1) & ' but Not '&Max(year) &': '&COUNT({<year = {'$(=Max(year)-1)'}, CODE = E({1<year = {'$(=max(year))'}>}CODE)>}DISTINCT CODE)