4 Replies Latest reply: Jan 22, 2014 6:49 PM by Srikanth Narasimhan RSS

    Using aggregated fields for further processing

      Hi,

       

      I have a few aggregated fields in my load script and want to do some calculations on these fields:

       

      .....

      LOAD *,

      If([Energy Diff] = 0 OR [MedianModTemp] = 0 OR [MedianIrr] = 0, 0,[MedianModTemp]) as [CommCorrectedModTemp],

      If([Energy Diff] = 0 OR [MedianModTemp] = 0 OR [MedianIrr] = 0, 0, [Energy Diff]) as [CommCorrectedEnergy],

      If([Energy Diff] = 0 OR [MedianModTemp] = 0 OR [MedianIrr] = 0,0, [MedianIrr]) as [CommCorrectedIrr]

      ;

       

       

      LOAD Project,

      ...

           Energy,

           Irr1,

           Irr2,

           ModTemp1,

           ModTemp2,

           if (IsNull(Energy),0, Energy) - (if (IsNull (Previous(Energy)),0,Previous(Energy))) as [Energy Diff],

           (if (IsNull(ModTemp1),0,ModTemp1) + if(IsNull(ModTemp2),0,ModTemp2))/2  as [MedianModTemp],

           (if (IsNull(Irr1),0,Irr1) + if(IsNull(Irr2),0,Irr2))/2 as [MedianIrr]

      ...

      [SUMMATION]:

      LOAD

      Sum(CommCorrectedEnergy) as [Daily Energy],

      Date

      Resident MAIN

      Group By Date

      ;

      LOAD

      Sum(CommCorrectedIrr) as [Daily IRR],

      Date

      Resident MAIN

      Group By Date

      ;

      LOAD

      Sum(CommCorrectedModTemp) as [Daily ModTemp],

      Date

      Resident MAIN

      Group By Date

      ;

       

      I want to do the following

      [GetIns]:

      LOAD

      [Daily modTemp]/[Daily IRR] as [ModTempIns]

      ;

       

      I get an error when I do this. Where should I be placing this? If I place before [SUMMATION], I get an error, if I place in the end after [SUMMATION], I don't get an error, but it does not seem to be doing anything as I don't see the field [ModTempIns] created.

       

      Thanks

      Srikanth