I am not able to select query fetch non duplicate data

I used dremio’s ROW_NUMBER() OVER (PARTITION BY Tag ORDER BY Sysmoddate DESC)
to remove duplicate data from select query, but it’s returning some random number as row number. In other cases in database same query is working by put condition like rn > 1 but here numbers are changing. Eventhough Group By xxx ORDER BY MAX(xxx) desc,also not working here.
Is there something else to remove duplicates from data in Dremio.