3 Replies Latest reply: Oct 11, 2012 3:42 PM by John Witherspoon RSS

    Set Analysis

      Hi Guys


      I have a table say  with the following fields



      i want to change my expression : Count(if(Date1 = Date2,ID))

      into Set Analysis....


      Is it possible???

        • Re: Set Analysis
          Gysbert Wassenaar

          You can, but why do you want that?

          I think the set analysis expression would be:  count( {<[Date1]={"=[Date1]=[Date2]"}>} ID)

          • Re: Set Analysis
            Iyyappan v



            Try like this


            = Count({<DateFieldNum1={'=$(=Num(DateFieldNum2))'} ID)



            In Script


            DateFieldNum1 = Floor(Num(DateFieldNum1))

            DateFieldNum2 = Floor(Num(DateFieldNum2))



            • Re: Set Analysis
              John Witherspoon

              I wouldn't do it with the if OR with set analysis.  For performance, I'd suggest setting a counter in the script load like this:


              if(Date1 = Date2, 1) as "Dates Equal Counter",


              Or possibly more generally useful, as it could be used as a chart dimension, for instance, to only show IDs where the dates are equal:


              if(Date1 = Date2, ID) as "Dates Equal ID",


              Then experiment to find out which of the following is faster:


              count("Dates Equal ID")
              sum("Dates Equal Counter")


              Different QlikView versions have differed in that regard.