Row aggregations

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

My final tabel I have
Subcategory |amount|offamt|onamt

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
Six Stars

Re: Row aggregations

Please help me anyone

Fifteen Stars TRF
Fifteen Stars

Re: Row aggregations

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?

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 existing table is :
S no|Subcategory| cost|amount
1|team outing|100|200
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
The above are the column names And I want some calculations based on the existing table like

The below us my final table:
Total cor|900|1000
Gross margin|1100|1200
(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..

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach


Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.