Highlighted
Six Stars

## Row aggregations

Hi ,
I want some solution to my problem ..I have a table and that should be converted to the final table through talend ...I have a input table like subcategory|review|amountbudget
A|xxxxxx|100
B|iuuuuuu|200
C|kkkkkk|300
D|llllllllh|400
E|iiiiiiii|500
F|ooooooo|600
G|qqqqqq|700

My final tabel I have
Subcategory |amount|offamt|onamt
Totalcor|
Pat|
Pbt|
Grossmargin|

If the subcategory is a,b,c then the amount should be calculated for that and give in the offamt in the row totalcor
If the subcategory is a,b,d the amount should be calculated for that and give in the off AMT in the row Pat
If the subcategory is a,e,f the amount should be calculated for that and give in the off AMT in the row Pbt....

..
..
So the row level calculations should be done based on the subcategory and based on that in that particular row the amount should be reflected ... Could anyone please help me in solving this
Highlighted
Six Stars

## Re: Row aggregations

Please help me anyone

.
Highlighted
Sixteen Stars

## Re: Row aggregations

Hi,
Your explaination is not clear at all.
When you said "If the subcategory is a,b,c..." but subcategory cannot be a,b,c at the same time as these values appear on different rows.
Can you show us the expected result based on your data sample?

TRF
Highlighted
Six Stars

## Re: Row aggregations

Hi sir ,, Actually I have an existing table with a columns like ... I vil give one example in the below ..my existing table is :
S no|Subcategory| cost|amount
1|team outing|100|200
2|revenue|300|440
3|depreciation itis|450|600
4|depreciation erp|700|800
5| other facility costs|600|900
And so on.... This is my existing table ..and in this still more columns are there
Now I want a final table like For example
Sno|subcategory|offshoreamount|onshoreamount
The above are the column names And I want some calculations based on the existing table like

The below us my final table:
Subcategory|offamnt|onamnt
Total cor|900|1000
Gross margin|1100|1200
Pat|1090|2000
pbt|4000|567
(above amount values are just an example values not the results from the formula )
And so on ...
The final table is like the above And Calculations are
'Total cor' as subcategory
1)If subcategory in (teamouting,depreciation itis) then the cost as offamnt
2)If sum(subcategory in (teamouting,depreciation itis) then the cost+1 ) as onamnt

'Gross margin' as subcategory
3) If sum(subcategory in (teamouting,depreciation itis,depreciation erp) then the cost-1 ) as offamnt
4)If sum(subcategory in (teamouting,depreciation itis,depreciation erp) then the cost-1 ) as onamnt
And for every subcategory row ...the calculation columns offamnt and onamnt are taken based on the subcategory of the existing table ...
I got a requirement as existing table and now my target is to achieve the final table ....Please help me in this ...thanks..

## 2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

## OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

## Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

## Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

## Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog