Groupby with count

Two Stars

Groupby with count

task.JPG

Please help me out this in talend.


Accepted Solutions
Community Manager

Re: Groupby with count

OK, this is a little difficult to talk you through on here, so I have knocked up a quick example Job in v6.2.1. If you are using a later version of Talend you will be able to import this.

 

The important logic is in the tMap and the tAggregate. 

 

1) I combine the Name fields

2) I add a 1 to non-numeric rows and a 0 to numeric rows then use the tAggregate to "sum" that field ....giving the count.

3) I group by the Name field and return only the first record of the Group

 

 

 

 

 

 


All Replies
Community Manager

Re: Groupby with count

You need to give more information. We will need precise rules for grouping which are not provided. For example, are only non-numeric IDs that come after numeric IDs counted? What happens is Nam1, Name2 and Name3 all have values? What happens if the same ID (numeric) has different Names?

 

You need to analyse this and fully understand your problem so that you can ask for advice on how to achieve it.

Two Stars

Re: Groupby with count

Hi Hall,

Thanks for your reply.

 

1. Are only non-numeric IDs that come after numeric IDs counted?

---Yes, non-numeric IDs that come after numeric IDs should be counted.

 

2.What happens is Nam1, Name2 and Name3 all have values?

---Either of Name1, Name2 and Name3  have value

 

3.What happens if the same ID (numeric) has different Names?

---Same ID with same names is considered.

 

Tried using Tmap & aggregate row, but things not worked for me

Please help me out Hall.Much appreciable

 

Regards,

Blessey

Community Manager

Re: Groupby with count

OK, this is a little difficult to talk you through on here, so I have knocked up a quick example Job in v6.2.1. If you are using a later version of Talend you will be able to import this.

 

The important logic is in the tMap and the tAggregate. 

 

1) I combine the Name fields

2) I add a 1 to non-numeric rows and a 0 to numeric rows then use the tAggregate to "sum" that field ....giving the count.

3) I group by the Name field and return only the first record of the Group

 

 

 

 

 

 

Two Stars

Re: Groupby with count

Great..!

Thanks for all your help & your time Hall.Worked for me

 

Regards,

Blessing

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now