4 Replies Latest reply: Mar 27, 2013 2:43 AM by Parthiban Durairaj RSS

    Set analysis - sum condition

      How to count the number of licences in newest version?

       

      There are have two tables(below): Versions and Licences of application

       

      Version table

      Version.KeyVersionDateInVersionDateOut
      12009-10-012010-03-03
      22010-03-042011-12-04
      32011-12-052012-05-23

       

      Licence table

       

      LicenceVersion.KeySaleDateSaleDateYM
      ABC4512009-11-022009-11
      ABC2312009-11-252009-11
      ABC6512010-01-142010-01
      ABC7622010-05-122010-05
      ABC9922011-08-232011-08
      ABC4332012-01-122012-01

       

      How to obtain the column 3 : Sum all newest licences aggregated in period

      SaleDateYMSum of sold in YMSum all licences in newest version
      2009-1122 (current ver.key 1)
      2010-0113 (current ver.key 1)
      2010-0511 (current ver.key 2)
      2011-0812 (current ver.key 2)
      2012-0111 (current ver.key 3)

       

      Sum of sold is very easy to count but how to obtain  sum all licences in newest version in period ?