I am trying to rank data based off multiple factors and having trouble doing so. I want to rank each Batch and Material based off the most recent entry date and max value material doc item. (So 2 over 1 etc)
In the above sample data I would expect row 5 to be ranked 1 as it is the most recent date with the highest material doc item.
Current Logic:
RANK () OVER (PARTITION BY BATCH, MATERIAL ORDER BY BATCH, MATERIAL , ENTRY_DATE , MATERIAL_DOC_ITEM DESC ) AS RANK_NUM
Any guidance would be much appreciated