Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to calculate average of the column in the data load editor script and store it in a variable.
products table looks like this :
I need to calculate the avg(col d). I tried the below line but, avgPRC is blank.
LOAD avg([Count]) as avgPRC resident [PRODUCTS];
This work:
InlineData:
Load * inline [
Col A, Col b, Col C, Col d
A1,Cc1,Type a,18
A2,Cc2,Type b,21
A3,Cc1,Type c,89
];
AvgCold:
Load
Avg([Col d]) as [Avg Col d]
Resident InlineData;
let vAvgCold=peek('Avg Col d',0,'AvgCold');
Drop Table AvgCold;
And the variable is populated:
This work:
InlineData:
Load * inline [
Col A, Col b, Col C, Col d
A1,Cc1,Type a,18
A2,Cc2,Type b,21
A3,Cc1,Type c,89
];
AvgCold:
Load
Avg([Col d]) as [Avg Col d]
Resident InlineData;
let vAvgCold=peek('Avg Col d',0,'AvgCold');
Drop Table AvgCold;
And the variable is populated: