Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum/Group By result to qvd

This has to be something I am overlooking, but when I try to store the new result from the second table, it does not save in the qvd.

I imported an excel file and performed some data cleaning and some conversions from mg to grams, kg/mg to grams, and grams. Each conversion was stored in a different column ( mgGm, mgKgGm, Grams).  Because the files are fairly large, I stored the table (drug1) into a drug1.qvd.

Next, I created a new table (Drug2) and loaded drug1.qvd. 

I tried to sum all of the conversion as an expression, but the personal version of qlikview just froze with the large amounts of records.  I figured doing this in the script and creating a new column in the qvd would be better.  I have tried many different ways, with no success. 

I need to sum the values of each conversion and add a new column (totalGrams) to the drug1.qvd

Drug2:

load  Number, Brand Name, Taxonomy,

sum(mgGm) + sum(mgKgGm) + sum(Grams) as totalGrams

resident drug1
Group By Number, Brand Name, Taxonomy;

Store Drug2 into drug1.qvd

1 Solution

Accepted Solutions
marcus_sommer

It looks like a syntax issue:

Brand Name must be [Brand Name] and

"Store Drug2 into drug1.qvd" must be Store Drug2 into drug1.qvd (qvd);

- Marcus

View solution in original post

2 Replies
Nicole-Smith

Makes me wonder if it has anything to do with adding the three sums together within the group by.  Try the following and see if it works any better (you're also missing brackets around the field name that has a space in it):

Drug2:

load Number, [Brand Name], Taxonomy, mgGmSum + mgKgGmSum + GramsSum as totalGrams;

load  Number, [Brand Name], Taxonomy,

sum(mgGm) as mgGmSum, sum(mgKgGm) as mgKgGmSum, sum(Grams) as GramsSum

resident drug1

Group By Number, [Brand Name], Taxonomy;

marcus_sommer

It looks like a syntax issue:

Brand Name must be [Brand Name] and

"Store Drug2 into drug1.qvd" must be Store Drug2 into drug1.qvd (qvd);

- Marcus