4 Replies Latest reply on Oct 23, 2017 2:59 PM by robert b

    Scalar arithmetic

    robert b

      I am trying to create a calculated field where I subtract a constant from all values in one of my columns of data.  I am getting "cannot mix aggregate and non-aggregate values in this function" as an error.  The constant is the sum of one column divided by the sum of another--essentially a weighted average.  I cannot use avg because I need the average to be weighted.  Even if I could, I get the same error with average. This also comes up when I attempt to multiple the value by one of my vectors. 

       

      [Shipment Cnt]*([Cost Ship]-[avg_cost]), where shipment Cnt and cost Ship are vectors, and avg_cost=sum(cost ship)/sum(ship cnt)