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

# 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:

.....

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]

;

...

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]:

Sum(CommCorrectedEnergy) as [Daily Energy],

Date

Resident MAIN

Group By Date

;

Sum(CommCorrectedIrr) as [Daily IRR],

Date

Resident MAIN

Group By Date

;

Sum(CommCorrectedModTemp) as [Daily ModTemp],

Date

Resident MAIN

Group By Date

;

I want to do the following

[GetIns]:

[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

• ###### Re: Using aggregated fields for further processing

Hey Srikanth,

You could be getting an error message as the fields used for Calculating [ModTempIns] are created after summation. So the place where you are doing this is correct.

Also make sure you are not dropping the table/field. Also please check the Table viewer and look for the field in that table.

• ###### Re: Using aggregated fields for further processing

Thank you, Ajay.

Adding it at the end of the script does not give an error, but the field is not visible/accessible either. It is not in Table viewer as well.

...

Sum(CommCorrectedModTemp) as [Daily ModTemp],

Date

Resident MAIN

Group By Date

;

[GetIns]:

[Daily ModTemp]/ [Daily IRR] as [ModTempIns]

;

• ###### Re: Using aggregated fields for further processing

[SUMMATION]:

*,

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

Sum(CommCorrectedEnergy) as [Daily Energy],

Sum(CommCorrectedIrr) as [Daily IRR],

Sum(CommCorrectedModTemp) as [Daily ModTemp],

Date

Resident MAIN

Group By Date ;

• ###### Re: Using aggregated fields for further processing

Perfect, Thanks