Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Syntax Help

Hi All,I'm relatively new to Qlikview si this might be an obvious problem but myself and my colleague have been banging our heads against the wall trying to figure this out. Basically what I am trying to produce is a comparison table between the year selected and the previous year. It works fine for the selected year, but when I change the expression to look at the previous year nothing is shown. I know the data is there as when I selected the other years the cselected year data always shows. These are the two expressions I have used:

Selected Year:
Count (if (InYearToDate (Matters.OpenedDate, SetDateYear('31/12/2012', GetFieldSelections(OpenedYear)), 0), Matters.OpenedDate))
Selected Year minus 1:
Count (if (InYearToDate (Matters.OpenedDate, SetDateYear('31/12/2012', GetFieldSelections(OpenedYear)), -1), Matters.OpenedDate))
Any pointers would be great.Thanks
1 Solution

Accepted Solutions
MVP
MVP

Re: Syntax Help

If you select a year, the data that count() function will get as input is limited to that year by default.

You probably need to use set analysis to disregard the current year selection:

Count ({<OpenedYear= >} if (InYearToDate (Matters.OpenedDate, SetDateYear('31/12/2012', GetFieldSelections(OpenedYear)), -1), Matters.OpenedDate))

You can probably also replace your if() function with set analysis, please check out the set analysis section in the Help file.

Regards,

Stefan

2 Replies
MVP
MVP

Re: Syntax Help

If you select a year, the data that count() function will get as input is limited to that year by default.

You probably need to use set analysis to disregard the current year selection:

Count ({<OpenedYear= >} if (InYearToDate (Matters.OpenedDate, SetDateYear('31/12/2012', GetFieldSelections(OpenedYear)), -1), Matters.OpenedDate))

You can probably also replace your if() function with set analysis, please check out the set analysis section in the Help file.

Regards,

Stefan

Not applicable

Syntax Help

Thank you that worked perfectly.