3 Replies Latest reply: Jul 23, 2014 10:39 AM by Simon Brulotte RSS

    Joining the sum of a colomn as a field value

    Simon Brulotte

      Hi,

       

      I have two tables (see excel file), one with Rules (Règles sheet) and one with Titles (Titre sheet).

       

      I'm trying to sum the value of Flag 1 for each Titre, and put that value in a single field value for a new filed called Bris.

       

      Here was a script idea that I thought would work:

       

      Règles:

      LOAD Règle,
          
      Description
      FROM
      [CONFORM.xlsx]
      (
      ooxml, embedded labels, table is Regles);

      Titre:
      LOAD Titre,
          
      [Flag 1],
          
      [Flag 2],
          
      [Flag 3]
      FROM
      [C:\Users\sbrulott\Desktop\CONFORM.xlsx]
      (
      ooxml, embedded labels, table is Titres);


      left join (Règles)
      load
      sum([Flag 1]) as Bris,
      '1'
      as Règle
      resident Titre;



      left join (Règles)
      load
      sum([Flag 2]) as Bris,
      '2'
      as Règle
      resident Titre;


      left join (Règles)
      load
      sum([Flag 3]) as Bris,
      '3'
      as Règle
      resident Titre;

       

       

      Evidently this doesn't work.

      I could cald my colomne names Bris1, Bris2, Bris3 and that would bring me back what I need, but this summ needs to show up in a single field called Bris.

       

      Help?