1 Reply Latest reply: Oct 12, 2018 4:07 AM by Ruan Greeff RSS

    Sum of a table

    Vincent Bellanger

      Greetings,

       

      I'm importing 2 tables from my database that looks like this:

      KeyServerCpu
      358Server1Processor 1 Core 1 Thread 1
      358Server1Processor 1 Core 1 Thread 2
      360Server2Processor 1 Core 1 Thread 1
      360Server2Processor 1 Core 1 Thread 2
      360Server2Processor 1 Core 2 Thread 1
      KeyServerRAM
      358Server18G
      358Server18G
      360Server216G
      360Server28G

       

      and i'm trying to do a table that count the number of CPU for a server and a sum of the RAM for the same server so my table would look like this:

       

      KeyServerCpuRAM
      358Server1216
      360Server2324

       

      Thanks for helping!

        • Re: Sum of a table
          Gabor Tarnoczai

          Hi Vincent,

           

          This task don't need any modification in load script.

          Place a simple table object on the sheet, and add these dimensions: Key, Server

          and these measures: =count(Cpu), =sum(num(replace(Ram,'G',''))


          The tables share the Key field, therefore they are linked.


          G.

          • Re: Sum of a table
            Ruan Greeff

            TABLE1:

            LOAD Key,

                 Server,

                 Cpu

            FROM

            [Your directory here]

            (ooxml, embedded labels, table is Sheet1);


            TABLECPU:

            LOAD Key,Server,Count(Cpu) as [Number of CPU's]

            Resident TABLE1

            Group by Key,Server;

            drop table TABLE1;


            TABLE2:

            LOAD Key,

                 Server,

                 MID(RAM,1,Len(RAM)-1) as RAM

            FROM

            [your directory here]

            (ooxml, embedded labels, table is Sheet2);


            TABLERAM:

            LEFT JOIN (TABLECPU)

            LOAD Key,Server, sum(RAM) as RAM

            Resident TABLE2

            group by Key,Server;

            drop table TABLE2;