Counting rows and summing columns in same aggregator stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Counting rows and summing columns in same aggregator stage

Post by manuel.gomez »

I am sure this must be something already discussed, but I just cant find any posts in the forum.

Is not possible to count rows and sum columns in the same Aggregator stage?

Due to Aggregation Type property, you always have to choose between 'Calculation' (where there is no calculation for counting, the most similar I found was Weighting column) and 'Count Rows'

Is not possible to do both, as you do in typical SQL queries?
select count(*), sum(col1), sum(col2) from table
Thanks a lot!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It would seem not, I just played around with the aggregator stage and couldn't find a way of doing with just one stage. Perhaps someone else has found another solution.
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post by yimwai »

add a column before with value "1" , then sum
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

yimwai - that's a simple and elegant solution :)
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Post by manuel.gomez »

ArndW wrote:yimwai - that's a simple and elegant solution :)
I agree, I guess I will do this!
Post Reply