8 Replies Latest reply: Aug 8, 2014 7:20 AM by Tom Tierney RSS

    Sum values when field equals

    Tom Tierney

      All,

       

      I have the following data; (Assume blank field values are Nulls)

       

      IDTypeValue TypeValue
      11
      12
      13
      1210
      1315
      1220
      22
      24
      225
      2210
      35
      3210

       

      I want to sum the Value field if the ID has Type = 1 or 2. (The 'Value Type' can be ignored)

       

      So the result would be;

       

      ID 1 = 45, ID 2 = 15, ID 3 = 0

       

      Ideally I would want to accomplish this in the Load Script and not at the object stage (Set Analysis etc.)

       

      The real data is in a single DB view and has approx. 1M rows and many more fields. What is the best approach in terms of optimisation? Mapping table/Cross table?