3 Replies Latest reply: Dec 1, 2014 1:34 PM by Kevin Harvie RSS

    New to set analysis. Why doesn't this work?

    Kevin Harvie

      I am trying to use set analysis almost for the first time.  I think I'm getting hung up on syntax.

       

      QlikView says the expression is OK, but it is still gives me the sum of cloudAgentSpaceUsedGB instead of limiting the set to the most recent cloudAgentSnapshotDate.  Am I doing something wrong?

       

      sum( {$<cloudAgentSnapshotDate = {"=max(cloudAgentSnapshotDate)"} >} cloudAgentSpaceUsedGB)

       

       

      Thanks!

       

      -Kevin

        • Re: New to set analysis. Why doesn't this work?
          Jonathan Poole

          Date comparisons can be tricky.  Try going with a literal (single quotes)  instead of a search  (double quotes)

           

          change:

          sum(  {$< = {"=max(cloudAgentSnapshotDate)"} >} cloudAgentSpaceUsedGB)

          to:

          =sum( {$<cloudAgentSnapshotDate={'$(=Date(max(cloudAgentSnapshotDate)))'}>}   cloudAgentSpaceUsedGB)

          • Re: New to set analysis. Why doesn't this work?
            Saradhi Balla

            few things to consider:

             

            1. format of the date. max(cloudAgentSnapshotDate) will return numeric value of the date which is being compared to formatted time value, cloudAgentSnapshotDate.

             

            2. Date function with the correct formatting should help. something like - Date(max(cloudAgentSnapshotDate), 'MM/DD/YYYY') - modify the format to your application. if the format is not correct, the sum value will not be what you expect as well.

             

            3. i would set a variable and use it in the set analysis expression. so define a variable vMaxDate as the expression in step 2 and for your sum expression the following:

             

            sum(  {$<cloudAgentSnapshotDate = {"$(=vMaxDate)"} >} cloudAgentSpaceUsedGB)

             

            hope this helps.