# Sorting by calculated value

**URL:** <https://forum.bubble.io/t/sorting-by-calculated-value/263636>\
**Category:** Database\
**Created:** [May 20, 2023, 2:39am UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636 "2023-05-20T02:39:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![account\_bubble\_licon](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@account\_bubble\_licon](https://forum.bubble.io/u/account_bubble_licon)\
**Post date:** [May 20, 2023, 2:39am UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/1 "2023-05-20T02:39:34Z")

</div>

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

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

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.

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 20, 2023, 9:12am UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/2 "2023-05-20T09:12:58Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![account\_bubble\_licon](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@account\_bubble\_licon](https://forum.bubble.io/u/account_bubble_licon)\
**Post date:** [May 20, 2023, 12:22pm UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/3 "2023-05-20T12:22:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![account\_bubble\_licon](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@account\_bubble\_licon](https://forum.bubble.io/u/account_bubble_licon)\
**Post date:** [May 20, 2023, 2:09pm UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/4 "2023-05-20T14:09:15Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/3/4340b60f14060dd359fa5a9dc2f41fc7c33106c0.png)

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

Thanks,

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 20, 2023, 6:15pm UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/5 "2023-05-20T18:15:34Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![account\_bubble\_licon](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@account\_bubble\_licon](https://forum.bubble.io/u/account_bubble_licon)\
**Post date:** [May 21, 2023, 12:36am UTC](https://forum.bubble.io/t/sorting-by-calculated-value/263636/6 "2023-05-21T00:36:07Z")

</div>

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.  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/4/74e1adba797ad9efa58c3068b400f4b168fed60b.png)
