2 Replies Latest reply: Dec 5, 2014 1:45 AM by alexandra burovik RSS

    Group by: Invalid Expression

      Hello!

      Could someone help me, please,  to find out, what is wrong in script?

      type_fact:

      load

      State ,

      Company,

      Channel,

           Material_Name,

           Type ,

           TradeMark,

           Direction ,

           DocNumber,

           //Weight,

           Date,

        Year(Date) as Year,

        Month(Date) as Month,

           Client_code,

           sum(Weight) as type_sum_weight,

         'All'&Type as Group

      resident FACT Group by Direction,TradeMark,Type,Company, State,Channel;

       

      FACT- is a table, result of some joins, type_fact is a table of aggregatetd values of salesAmount (in weight)/ I wanted load not all fields in the type_fact, onle those needed for aggregation.

      Thnx in advance

        • Re: Group by: Invalid Expression
          whiteline _

          Hi.

           

          You have to mention all of the fields that are supposed not to be aggregated (all except Weight in the above case).

          group by is a clause used for defining over which fields the data should be aggregated (grouped). The aggregation fields should be included in some way in the expressions loaded. No other fields than the aggregation fields may be used outside aggregation functions in the loaded expressions.