3 Replies Latest reply: Jun 19, 2017 9:22 AM by Sunny Talwar RSS

    group by does not work

    Christian Schmitz

      Hi,

       

      I am loading for am external source a table with following field (From, To information, revenue, contribution margin, YearWeek info)

       

      Load

          Geo_From_Name_AvgCalc as Geo_From_Name_Avg,

          Geo_To_Name_AvgCalc as Geo_To_Name_Avg,

           DB as DB_Avg,

           rev_Complete as rev_Avg,

           Year_Week_Avg as Year_Week_Avg

      Resident facts;

       

      There are mutiple values for each Geo From, Geo To Combination and in the Frontend I make the sum(rev_Avg) and sum(DB_Avg) to get my values.

       

      Now I would like to use a group by, so that in the DM there should be per Geo From, To combination just ONE single line anymore.

       

      Load

          Geo_From_Name_AvgCalc as Geo_From_Name_Avg,

          Geo_To_Name_AvgCalc as Geo_To_Name_Avg,

           sum(rev_Complete) as rev_Avg,

           sum(Year_Week_Avg) as Year_Week_Avg

      //  Year_Week_Avg as Year_Week_Avg

      Resident facts

      group by Geo_From_Name_AvgCalc ,Geo_To_Name_AvgCalc ;


      The script is working unfortunately the result is just wrong.


      Instead of e.g. 1468,95$ rev for East Africa to Asia the revenue is 1083,95$ - which is wrong.


      How can this happen?? Any ideas are welcome.


      Is there anything wrong of my understanding of group by clause???


      Thank you!


      Chris