Ranking and filtering the highest rank

Hi, I have data for a few months (column Period) and in excel a user filters the last month and works with it.
I have a question how I can do the same in knime if the user does not have an access to a workflow.
One solution I see is that I can add ranking to to column Period (JAN has rank 1, FEB has rank 2 and so on), then I can filter the highest rank (in my case it is DEC) and work further with data for DEC. There is one problem that this column has indication of a year as well and year will change. Can someone help me with such a workflow or propose any other solution?

Period Amount
JAN20 10
FEB20 24
MAR20 455
APR20 566
MAY20 526
JUN20 669
JUL20 99
AUG20 99
SEP20 88
OCT20 812
NOV20 5484
DEC20 546

Can you simply change the way your period is formatted? Instead of Month-Year, can you format it as Year-Month? E.g. 202001 (Jan 2020), 202002 (Feb 2020), 202003, 202004… etc. Then just sort in descending order.

There may be a way to use the String to Date&Time node to parse the way you have your Period currently formatted, but I was unsuccessful. Perhaps someone else can provide the proper date format conversion.

Otherwise, yes, you can use the Rule Engine node to create another column and sort off that column. Something in the rule engine like:
image
should work fine.

1 Like

Hey, thanks for trying! I need also to remember that next year values will be JAN21, …21 and so on and my workflow should be still robust.

Try using the Cell Splitter By Position node
image

Output:
image

You can then use these columns in conjunction with something like Rule Engine to get it into the proper format (Year – Month).

2 Likes

Maybe you could use the date&time input to get todays date and then filter your data based on that. This should adjust automatically each time you execute the workflow.
BR

1 Like

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