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

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 /

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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

View solution in original post

3 Replies
Gysbert_Wassenaar

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
Master
Master
Author

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..

Gysbert_Wassenaar

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


talk is cheap, supply exceeds demand