Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
saikripa
Contributor III
Contributor III

qlik data load editor

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 :

saikripa_0-1638335815874.png

I need to calculate the avg(col d). I tried the below line but, avgPRC is blank.

LOAD avg([Count]) as avgPRC resident [PRODUCTS];

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

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:

micheledenardi_0-1638527451786.png

 

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
micheledenardi
Specialist II
Specialist II

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:

micheledenardi_0-1638527451786.png

 

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
saikripa
Contributor III
Contributor III
Author

Hi Micheledenardi,

Thanks for your suggestion. It worked 

PRE