1 Reply Latest reply: Nov 17, 2014 12:09 PM by Marcus Malinow RSS

    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