# Using 'Rank' in formulas?

**URL:** <https://community.fibery.io/t/using-rank-in-formulas/951>\
**Category:** Get Help\
**Created:** [September 3, 2020, 10:06am UTC](https://community.fibery.io/t/using-rank-in-formulas/951 "2020-09-03T10:06:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 3, 2020, 10:06am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/1 "2020-09-03T10:06:02Z")

</div>

Does anyone have any examples of using Rank in a formula? I can imagine finding it useful, but since it seems to be a specific data type (not a string, integer, bool etc.) then I can’t figure out how to use it…

---

<div class="post-metadata">

**Author:** ![mdubakov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mdubakov/32/10_2.png) [@mdubakov](https://community.fibery.io/u/mdubakov)\
**Post date:** [September 3, 2020, 12:45pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/2 "2020-09-03T12:45:41Z")

</div>

Do you have any scenario in mind?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 3, 2020, 1:01pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/3 "2020-09-03T13:01:15Z")

</div>

Actually, the question was triggered by this other discussion:

> [@Filtering and getting first element](https://community.fibery.io/t/filtering-and-getting-first-element/948):
>
> Hi, I’m wondering if there is a way to filter and then select the first match in a formula. Something like: ItemPrices.filter(Price = ItemPrices.min(Price)).first().Vendor Alternatively, something like: ItemPrices.sort(Price).first().Vendor Thank you,

I figured that @Aram_Zadikian might be interested in returning the highest ranking vendor if there was more than one that had the cheapest price…

I also read [this discussion page](https://community.fibery.io/t/visual-indicator-of-priority-or-rank-heatmap/367) and wondered if a formula based on rank might provide the solution

---

<div class="post-metadata">

**Author:** ![tpaktop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/tpaktop/32/6394_2.png) [@tpaktop](https://community.fibery.io/u/tpaktop)\
**Post date:** [October 10, 2020, 3:42am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/4 "2020-10-10T03:42:09Z")

</div>

I have a scenario which I’m trying to use rank for.  
Given hierarchy like  
Project → tasks  
I noticed that tasks can be sorted within a project using drag&drop

 ![Screen Shot 2020-10-10 at 11.41.37 am](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/00747ed7c346f27f2c51429d2692ca6e989f76a3.png)

Which I presume is based on rank.

I would like to get highest ranking tasks to appear on top of my task list to make sure that I do them first without going into project to see the order of completion.

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [October 10, 2020, 4:01am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/5 "2020-10-10T04:01:12Z")

</div>

I have no idea if Rank works this way. But if not, a workaround could be to create a Field for “Priority” (or “Rank” or whatever) then create a Kanban board visualizing your Priorities, and you can drag between them to adjust priority. Then in Table view sort by Priority and you have a “do first” list.

---

<div class="post-metadata">

**Author:** ![tpaktop](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/tpaktop/32/6394_2.png) [@tpaktop](https://community.fibery.io/u/tpaktop)\
**Post date:** [October 10, 2020, 4:44am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/6 "2020-10-10T04:44:53Z")

</div>

The workaround works though we do calculate priority ourselves using complicated different weights.  
Rank would be sufficient enough and consider that it’s already exists in the system I don’t see why it cannot be exposed to be used in formulas.  
Any reason @mdubakov?

---

<div class="post-metadata">

**Author:** ![offcode](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/offcode/32/7522_2.png) [@offcode](https://community.fibery.io/u/offcode)\
**Post date:** [September 5, 2023, 2:05pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/7 "2023-09-05T14:05:27Z")

</div>

A similar idea. I have a backlog prioritized by dragging the most important items to the top. I want to show the top 5 on the team’s Kanban board, so they can pick up one next.

A workaround is to assign priorities, but it’s extra manual work and not fine-grained enough. If I mark 15 items as highest priority (out of a hundred), they will not be ordered in any meaningful way.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 5, 2023, 2:09pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/8 "2023-09-05T14:09:24Z")

</div>

> [@offcode](#):
>
> I have a backlog prioritized by dragging the most important items to the top. I want to show the top 5 on the team’s Kanban board, so they can pick up one next.

Is the backlog shared amongst several teams? If so, does this mean that the top 5 tasks for one team may not be the same top 5 for another team (but globally, they exist in a ranked order)?

---

<div class="post-metadata">

**Author:** ![offcode](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/offcode/32/7522_2.png) [@offcode](https://community.fibery.io/u/offcode)\
**Post date:** [September 6, 2023, 7:38am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/9 "2023-09-06T07:38:00Z")

</div>

It’s for one team, but I may want to filter it. For example, the product owner prioritizes the backlog by rank, the team estimates the tasks. Now, the I want to show only the top 5 tasks that have an estimation.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [September 6, 2023, 7:57am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/10 "2023-09-06T07:57:05Z")

</div>

What view did you imagine that the Team will use to view the top 5 tasks (that have been estimated)?

The reason I ask is because you mentioned a kanban, so i am wondering what the columns (and rows?) might be

---

<div class="post-metadata">

**Author:** ![offcode](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/offcode/32/7522_2.png) [@offcode](https://community.fibery.io/u/offcode)\
**Post date:** [September 7, 2023, 7:55pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/11 "2023-09-07T19:55:45Z")

</div>

The columns are statuses (though irrelevant for this use case), the rows are the assignees. You see on the board:

- all assigned tasks being worked on
- 5 unassigned tasks that people can choose from

---

<div class="post-metadata">

**Author:** ![HereBeBeasties](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/herebebeasties/32/5429_2.png) [@HereBeBeasties](https://community.fibery.io/u/HereBeBeasties)\
**Post date:** [June 11, 2024, 11:08am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/12 "2024-06-11T11:08:45Z")

</div>

Waking this thread back up again. I would really like to be able to use `[rank]` in formulae, if only to work around the issue in [Allow explicit ordering by rank](https://community.fibery.io/t/allow-explicit-ordering-by-rank/6135) that if you sort on `[some field]` then items are not sorted on `[rank]` beneath that.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [June 11, 2024, 11:28am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/13 "2024-06-11T11:28:27Z")

</div>

Do you have some examples of how you would want to use rank in a formula?

---

<div class="post-metadata">

**Author:** ![HereBeBeasties](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/herebebeasties/32/5429_2.png) [@HereBeBeasties](https://community.fibery.io/u/HereBeBeasties)\
**Post date:** [June 12, 2024, 8:55pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/14 "2024-06-12T20:55:39Z")

</div>

Well if it’s not possible to explicitly sort on it, then I could at least make a trivial formula field that exposes it, and sort on that. But it’s not accessible at all. It only appears if you try to make a field called “rank”, when Fibery tells you that is already taken.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [June 12, 2024, 9:18pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/15 "2024-06-12T21:18:07Z")

</div>

> [@HereBeBeasties](#):
>
> Well if it’s not possible to explicitly sort on it, then I could at least make a trivial formula field that exposes it, and sort on that

Sorting on rank is the default option if no other manual sort is applied, so it shouldn’t be necessary.  
Am I missing something?

---

<div class="post-metadata">

**Author:** ![HereBeBeasties](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/herebebeasties/32/5429_2.png) [@HereBeBeasties](https://community.fibery.io/u/HereBeBeasties)\
**Post date:** [June 20, 2024, 8:25am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/16 "2024-06-20T08:25:15Z")

</div>

> Sorting on rank is the default option **if no other manual sort is applied** , so it shouldn’t be necessary.

That is the key part. There are lots of use cases where you want to sort on something else as the primary, _then_ on rank.

For example, what if I’d like a Board view on an entity type with a number of Workflow states, want columns per Assignee (for example), but then want something more compact than applying the State as a row grouping. If I could `ORDER BY State DESC, Rank ASC`, then I could achieve a nice compact view on all this.

Or what if I have two entity types in a List view, and I’d like to ensure that one of the types appears wholly above the other, but then things are ordered by rank within the individual types? (I know I could make a Document and embed two List views for this use case, one of each Entity type, but that gives a somewhat different experience than I’d like.)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [June 20, 2024, 8:29am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/17 "2024-06-20T08:29:18Z")

</div>

> [@HereBeBeasties](#):
>
> Sorting on rank is the default option **if no other manual sort is applied** , so it shouldn’t be necessary.

Sorry, I wrote it badly.  
Sorting on rank is the default option after other manual sorting is applied (if any).

> [@HereBeBeasties](#):
>
> If I could `ORDER BY State DESC, Rank ASC`, then I could achieve a nice compact view on all this.

If you sort by State, then within a given state option group, the results will be sorted by rank.

> [@HereBeBeasties](#):
>
> I’d like to ensure that one of the types appears wholly above the other

We don’t currently have sorting by entity type, but this is an unrelated issue, no?

---

<div class="post-metadata">

**Author:** ![HereBeBeasties](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/herebebeasties/32/5429_2.png) [@HereBeBeasties](https://community.fibery.io/u/HereBeBeasties)\
**Post date:** [June 25, 2024, 9:59am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/18 "2024-06-25T09:59:01Z")

</div>

> Sorting on rank is the default option after other manual sorting is applied (if any).  
> …  
> If you sort by State, then within a given state option group, the results will be sorted by rank.

My initial response to that is “that can’t be right” but it turns out that it is. 🙂

So as a result I have now figured out the actual issue I am having, which is that if you sort by State (for example) then _you cannot reorder the rank within that State by dragging-and-dropping_, which gives the illusion that it’s not respecting rank order, when actually it’s just failing to update it on drag/drop.

I think that’s a bug?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [June 25, 2024, 10:48am UTC](https://community.fibery.io/t/using-rank-in-formulas/951/19 "2024-06-25T10:48:47Z")

</div>

> [@HereBeBeasties](#):
>
> _you cannot reorder the rank within that State by dragging-and-dropping_  
> …  
> I think that’s a bug?

It’s not a bug so much as a (desirable) feature that is not yet supported

> [@Allow explicit ordering by rank](https://community.fibery.io/t/allow-explicit-ordering-by-rank/6135/2):
>
> Do you mean that you want to be able to manually reorder within a primary sorting group?

---

<div class="post-metadata">

**Author:** ![HereBeBeasties](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/herebebeasties/32/5429_2.png) [@HereBeBeasties](https://community.fibery.io/u/HereBeBeasties)\
**Post date:** [July 2, 2024, 2:16pm UTC](https://community.fibery.io/t/using-rank-in-formulas/951/20 "2024-07-02T14:16:31Z")

</div>

> [@Chr1sG](#):
>
> It’s not a bug so much as a (desirable) feature that is not yet supported

Semantics. :-p The UI lets you drag, but not drop, which is surprising to users =\> looks like a bug to me. If you couldn’t drag things in the first place, it would look like a missing feature.

Anyway, we’d really like to be able to do this, regardless of what you call it.

[Next page](https://community.fibery.io/t/using-rank-in-formulas/951.md?page=2)
