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

Re: Row aggregations

Please help me anyone


.
Twelve Stars TRF
Twelve 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
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..