Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum of a table

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!

1 Solution

Accepted Solutions
undergrinder
Specialist II
Specialist II

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.

View solution in original post

2 Replies
undergrinder
Specialist II
Specialist II

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.

Anonymous
Not applicable
Author

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;