How to get one row with max value?

Hi -

I run the built-in Sentiment Analysis service and get a table that looks like this:

I’d like to get just one row, the one that has the highest Sentiment Score.

Next I use Find Max Value:

Then I use Join to match and bring the row that has the highest Sentiment Score:

This works but doesn’t seem like a very elegant solution.

Any advice if there is a better way to do this?

Hey Max! Thanks for your question. Here’s another way I might accomplish this:

  1. After your Sentiment Analysis step, add a Sort step, and sort your column, articles.description Sentiment Score in descending order.
  2. Then use the Row Numbers step to add a column of row numbers
  3. Finally, use the Row Filter step to filter for the row where Row Number = 1

Having the steps in this order will ensure that these steps will always pull the row with the highest sentiment score. It’s still a similar number of steps, but might feel more elegant than having to Rejoin.

Let me know what you think!

1 Like

Thank you - this helped!

2 Likes