2 Replies Latest reply: Mar 6, 2012 10:31 AM by gdavies83 RSS

    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
        • Re: Syntax Help
          Stefan Wühl

          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.