Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

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

View solution in original post

2 Replies
swuehl
MVP
MVP

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
Author

Thank you that worked perfectly.