Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Addition or subtraction of values in rows

Hello Experts,

i want to add and subtract the values received in load statement as shown in below table.

i have all data available in load statement except the calculated values marked in Yellow.

Please note that each value is received in a separate load statement and joined together. 

Is it possible to do this?

2019-06-12_16h03_07.png

 

For your information the number of rows are fixed.



thanks in Advance

2 Solutions

Accepted Solutions
sunny_talwar

Anonymous
Not applicable
Author

Thanks Genius 🙂

View solution in original post

13 Replies
sunny_talwar

Do you have 'Total X+Y' and 'B-A' and 'T+G-Y' as a value within GROUP?

Anonymous
Not applicable
Author

Not really 😞

I have X, Y separate as values  but not 'Total X +Y'... but i want the result in table like that.

All these values coming from a single QVD based on different conditions. Each with a separate load.

Each Group has a different condition.

sunny_talwar

Would you be able to share a small sample to show what you mean?

Anonymous
Not applicable
Author

Hello Sunny,

Sorry, was not in office yesterday.

Please see attached example. I have written few load statements for example.

i have all load statements for all criteria carried out on same table. 

the expected result is like

2019-06-14_08h21_34.png

Thanks

 

Channa
Specialist III
Specialist III

do with wildMatch

 

Concatenate below with your previous load

'X+Y',IF(wildMatch(Group,'X','Y'),SUm(Value)) resident Table

 

'A-B',IF(wildMatch(Group,'A',),SUm(Value))-IF(wildMatch(Group,'B',),SUm(Value))

Channa
Anonymous
Not applicable
Author

Sorry, but it's not working... gives error as invalid expression


SUMX_Y:
LOAD
'X+Y' as SGroup,
IF(wildMatch(Desc,'X*','Y*'),SUM(Value),0) as StockValue

resident Master;

Anonymous
Not applicable
Author

It needs a Group by for sum 😞
Channa
Specialist III
Specialist III

Table1:
LOAD
"Desc",
Value
FROM [lib://Source/Grouping.xlsx]
(ooxml, embedded labels, table is Sheet1);

Concatenate


LOAD
'X+Y' as Desc,
sum(Value) as Value Resident Table1 where WildMatch(Desc,'X','Y') ;

 

try

Channa
Anonymous
Not applicable
Author

Thanks, it already works for sum but how do i manage subtraction for
B-A
T+G-H