How can I work out Row numbers when Row_Number doesn’t work?

For a variety of reasons (such as this one, where the alteration of the underlying dataset is not allowed) it is sometimes not possible to just calculate the row number for a table using Row_Number. In these instances you can instead use a combination of CountDistinct and RunningValue, as I mentioned in my original answer.