Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Rich5678
Contributor III
Contributor III

Use Total function in Loading Script

Hi,

Is there an equivalent of  Sum(total column) in Data Load Editor script.

I want to get the value of Expression - Sum(total MktVal) in the Loading script.
I can get the result of 5,769.03 in Table (shown below) when I add it as an Expression, but that is not what I am looking for...

Please see below example -> clearly below script is wrong, because I am Grouping using Cusip. 
Without Grouping, it gives me incorrect formula error.

SecData:
LOAD * inline [
Cusip|Qty|Price|MktVal
cusip1|545|99.3|541.19
cusip2|742|96.2|713.8
cusip3|865|100.9|872.79
cusip4|600|98.6|591.6
cusip5|772|95.7|738.8
cusip6|756|96|725.76
cusip7|876|96.5|845.34
cusip8|721|102.6|739.75
] (delimiter is '|');

MVTotal:
Left Join (SecData)
Load Cusip,
Sum(MktVal) as TotMktVal
Resident SecData
Group by Cusip;

Rich5678_0-1660350271033.png

 

 

This should be a very simple solution, but I am unable to arrive at that.

Could you help

Thanks

Labels (4)
1 Solution

Accepted Solutions
Digvijay_Singh
MVP
MVP

What if you don't group By and do like this - 

MVTotal:
Left Join (SecData)
Load
//Cusip,
Sum(MktVal) as TotMktVal
Resident SecData
//Group by Cusip;
;

View solution in original post

2 Replies
Digvijay_Singh
MVP
MVP

What if you don't group By and do like this - 

MVTotal:
Left Join (SecData)
Load
//Cusip,
Sum(MktVal) as TotMktVal
Resident SecData
//Group by Cusip;
;

Rich5678
Contributor III
Contributor III
Author

Many thanks..