Help with game-style library function

Hello and thanks for helping. The app I am creating is a community library. Users can add books to the library, mark them as favorites, if they have read them, and save them to read later.

I am trying to get a repeating group to show a list of users organized by different categories as a Leaderboard. I want one button to organize it by what level in descending order. Another should organize it by how many quests the user has completed. One should organize it by how many books they have read. And the final tab will be for how many books they have added to the library.
The way I have it set up currently is this. When a user adds a book to their finished books section that book goes into a list of books filed in the users data. So how do I get a repeating group to show who’s read the most books in descending order?
aswedxcf2

I also need to know how to have the books created by a certain user be tracked and added to their books added section.

Thanks in advance! Trying to learn as I go.