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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate Aggregated field then add back to original table.

Hi Guys,

I have a Sales Table with 5 fields:

Order_Number,

Sales_Value,

Sales_Volume,

Country

Region

I've loaded all the records into a table called 'Sales'. Now I want to create an Average price field (region wise). I know how how to aggregate using preceding load and group by:

Country_Sales:

Load*,

Total_Value/Total_Volume As Average_Price;

Load

Country,

Region,

Sum(Sales_Value) As Total_Value,

Sum(Sales_Volume) As Total_Volume

Resident Sales;

Group by Country, Region;

I want to add the field Average_Price back to the first Sales table. But each time I use a Join I get an increase in number of records, what am I doing wrong? Help much appreciated!!

regards,

H

1 Reply
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Hareesh,

what you're doing looks ok to me.

My only suggestion would be if you have used a QUALIFY statement somewhere in your script.

If not, could you upload a sample of your data to illustrate the issue?

Marcus