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: 
rafakmargos
Contributor III
Contributor III

Sum two rows of the same column

Hi,

I have a table like this:

TEMP:

Date, Name, Value

01/01/2020, Test, 10

01/01/2020, Test2, 20

02/01/2020, Test, 30

02/01/2020, Test2, 40

 

And I need to sum values of Test and Test2 and generate a new row per Date, like this:

FINAL_TABLE:

Date, Name, Value

01/01/2020, Test, 10

01/01/2020, Test2, 20

01/01/2020, Test+Test2, 30

02/01/2020, Test, 30

02/01/2020, Test2, 40

02/01/2020, Test+Test2, 70

 

How can I do this in the script?

 

Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda

@rafakmargos  try below

Data:
load Date, 
     Name, 
     Value
FROM Source;

Concatenate(Data)
load Date,
     'Test+Test2' as Name
     sum(Value) as Value
resident Data
where match(Name,'Test','Test2')
group by Date;

View solution in original post

2 Replies
Kushal_Chawda

@rafakmargos  try below

Data:
load Date, 
     Name, 
     Value
FROM Source;

Concatenate(Data)
load Date,
     'Test+Test2' as Name
     sum(Value) as Value
resident Data
where match(Name,'Test','Test2')
group by Date;
rafakmargos
Contributor III
Contributor III
Author

@Kushal_Chawda it worked. Thank you very much!