Sorting by calculated value

  1. "I will be using the following two Types:

    • Contract
    • User"
  2. "For the ‘Contract’ Type, there are the following fields:

    • Price
    • Price per person
    • Sales persons (This field stores a list of Users.)"
  3. “To further clarify, the ‘Price per person’ field stores the value of the ‘Price’ divided by the number of ‘Sales persons’ (Users). Additionally, there’s a ‘Contract number’ field in the Contract type.”

  4. "Based on the above, I want to display a sales ranking for each User on a dashboard page.

    • The ranking should display the total ‘price per person’ for each User.
    • The display order should be in descending order of the total ‘price per person’.
      Currently I can display user name and their total “price per person” by using repeating group. But can’t sort by total “price per person”. Can anyone guide me on how to implement this in Bubble?"

This question comes up on the forum a LOT (twice in the past 6 hours alone)

There are basically 2 ways

  1. (the simpler option) just add a Number field to the User datatype to store the Total Price Per Person - then use that field to sort your User’s

  2. User the ListShifter plugin, which will let you sort your list of Users by any other list you can generate (the Floppy plugin also lets you do this, I believe).

Hi, @adamhholmes

Thank you very much for your advice!
1st option seems easier but probably not working perfect when multiple users are logged in.
I will try your 2nd option (ListShifter).

Thanks again

1 Like

Hi, @adamhholmes

Unfortunately, ListShifter seems doesn’t fit to my use case. Total of “price per person” is the calculated value in the RG, not stored value in DB.

Do you think ListShifter still can solve my problem?
If not I will go with option 1.


Yeah I’m pretty sure it can - you can sort your list by any other list (it doesn’t have to come from the database).

Hi, @adamhholmes

I appreciate for your response.

In ListShifter case, what I tried is

  1. locate ListShifter in Design space and name it[User Ranking]
  2. Set [Data Type of List] as User
  3. Set [List to Shift] as Search for Users
  4. Create workflow for particular action
  5. Chose [SORT List a List Shifter KW]
  6. Set Element as [ListShifterKW User Ranking]
  7. Set Type of Sort by List as [User]
    I guess I should set [Sort by List] as next action, but not sure what I have to set here. Your advice would be a great help.

Thanks in advance.