How to count the member of groups?

I habe a table and grouped it. How can I count the totally records of a group and how to assign a group_id to each record?

For example, in the following table:

Student city gender score
Conny Berlin F 5
Thomas Berlin M 3
Ying Kaiserslautern F 4
Kartoffel Kaiserslautern F 5

I group the table by "city" + "gender", use the node "groupby", so I got three group:

  • group1: Berlin, F
  • group2: Berlin, M
  • group3: Kaiserslautern, F

Question 1: But how can I get the number of total records in each group?

  • group1: Berlin, F => 1 record
  • group2: Berlin, M => 1 record
  • group3: Kaiserslautern, F => 2 records

Question 2: How to assign each records the groud_id?

I want to get this table:

Student city gender score group_id
Conny Berlin F 5 group1
Thomas Berlin M 3 group2
Ying Kaiserslautern F 4 group3
Kartoffel Kaiserslautern F 5
 
group3

 Is there a node can do this task?

 

Best Regards,

Ying

 

 

Hi Ying,

You can do this by adding a manual aggregation column in the group by node using "Count" as aggregation method. For group ID, you can use the RowID node and then join to the original table.

I have attached an example workflow, hope that helps!

Cheers,

Roland

Hi Roland,

Thanks so much for the answer! It is so nice that you guys here for the help! :)

Cheers,
Ying