Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
soniasweety
Valued Contributor III

two sum in one cell

Hi All,

A:

Load * Inline

[

PID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,300,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];



b:

Load * Inline

[

ID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,150,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];



i have data like above.  here i want to show the result in stright table 


Year      (sum({TableA}Value)/sum({TableB}Value)  



for example      result for one row

year                      Sum

2018                    (650/500)           ------------------ here i want to show result two tables sum  as   (result1/result2)        within braket by sepertor /

Tags (2)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: two sum in one cell

MyTable:

Load *, 'A' as SourceTable Inline

[

PID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,300,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];

CONCATENATE (MyTable)

Load *, 'B' as SourceTable Inline

[

ID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,150,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];


Straight table:

Dimension: Year

Expression: ='(' &sum({<SourceTable={'A'}>}Value) & '/' & Sum({<SourceTable={'B'}>}Value) & ')'


talk is cheap, supply exceeds demand
3 Replies
MVP & Luminary
MVP & Luminary

Re: two sum in one cell

MyTable:

Load *, 'A' as SourceTable Inline

[

PID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,300,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];

CONCATENATE (MyTable)

Load *, 'B' as SourceTable Inline

[

ID,Year,Value,volume,Product

1,2018,100,300,A

2,2018,250,1,B

3,2018,150,2,C

4,2017,555,3,D

5,2017,5193,4,E

6,2017,6661,5,F

7,2017,100,6,G

];


Straight table:

Dimension: Year

Expression: ='(' &sum({<SourceTable={'A'}>}Value) & '/' & Sum({<SourceTable={'B'}>}Value) & ')'


talk is cheap, supply exceeds demand
soniasweety
Valued Contributor III

Re: two sum in one cell

thank you it worked

but one question-  like  use want to select   Product from   table b      how can  we identify  the value from  table b ?

for example  i add list box  product    i have  different values in table a and different values in table b..

MVP & Luminary
MVP & Luminary

Re: two sum in one cell

Add a listbox for the SourceTable field. Then select the required source table in that listbox.


talk is cheap, supply exceeds demand