How to give Rank based on Column Value

RowId are duplicate
We need to fetch unique RowId based on Rank
What is the correct approach that should be followed?
For getting Rank column correctly.

Row filter on Car as Audi?

Hey @shwetaoza,

The Rank node should support your use case :slight_smile:

Cheers,

@sjporter

1 Like

If the Rank is already given, couldn’t you just sort by that column ascending?

You could try and get some inspiration from the:

There also is an example with H2 standalone database and using window functions.

If the Rank is already given, couldn’t you just sort by that column ascending?

The Top k Selector node allows you to pick the top k values based on a sort.

Cheers,

@sjporter

I am so sorry, my input data is wrong!
Rank column is not given in INPUT
I need to create it based on that I can filter or sort
But for creating that column do not know what approach is better.

Also using group-by or row filter I will not be sure that which record it picks may be first may be second

Hi @shwetaoza , you should provide the data as a file (csv, Excel), or at least as Text that we can copy in our workflow. We can’t copy these numbers from a picture.

One question though, should you not have a column for “Suzuki”?

What you have in your latest picture is quite straight forward to implement:
Step1: Add Given data to a Table:
image
Step2, you can use the Rule Engine node:


Note: I default to 0 any Car that is not any of (“Audi”, “Toyota”, “Suzuki”)
Step3: you can use the Duplicate Row Filter on RowId and keep the lowest Rank value:

image
Step4: you can use the Column Expression node:

Step5: you can use Column Filter

And after all this, this is the result:
image

Of course, you can adjust all this to add the column Suzuki if ever it was supposed to be there.

Here’s what the workflow looks like:
image

And here’s the workflow: Rank based on column value.knwf (11.8 KB)

1 Like

Thankyou so much now I am clear about workings of each nodes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.