Skip to main content
Question

Get the highest value record

  • October 23, 2018
  • 3 replies
  • 273 views

raaaju1990
Contributor
Forum|alt.badge.img+6

I have set of records as below,

LinkIDoccurenceNAME123455ZXC2123457ABC1567893XYZ1567892SDF2567895YTR3

I need the record with maximum count based on occurence attribute. For example, from the above table, I need to extract only the below records.

Output,

LinkIDoccurenceNAME123457ABC1567895YTR3

Could anyone give me some suggestions please.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 23, 2018

Sorting by occurence in descending order, followed by a duplicate filter with a key attribute of LinkID will give you only max values out of the unique port.


virtualcitymatt
Celebrity
Forum|alt.badge.img+34

Use a StatisticsCalculator to get the max value per LinkID

 

Settings you need to set are:

 

group by = LinkID,

 

Attributes to analyze = occurrence

 

Calculate Attributes = only use '_max'.

 

If you know that the LinkID is ordered you can 'Input Ordered' to Yes for improved performance. If you'Re unsure then just leave is as no to be safe

 

 

The 'Complete' output port will then have added the _max value for each group of LinkID.

 

 

You can then use a Tester to see if 'occurrence = _max' .

 

This method is good if you want also get any cases where the max occurrence value can be equal.

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • October 23, 2018

Another options:

Sorter (sorting by occurrence (numeric, descending).

Sampler (group by LinkID, first 1 feature).

This will get you the required result and might be the faster way if you have a large dataset..


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings