How are racing percentages calculated?

Hi Folks! After finishing a race today a message popped up which said “You’ve finished in the top N% of riders.” How is N calculated? I assume it would be my ranking in my category divided by the number of riders in that category but that does not seen to be the case. I’m new to racing and have a feeling I’m missing something obvious here. Thanks!