# Ranking by number for cumulative calculation

**URL:** <https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098>\
**Category:** Ask for Help\
**Created:** [March 27, 2024, 4:15pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098 "2024-03-27T16:15:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 4:15pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/1 "2024-03-27T16:15:55Z")

</div>

Hello, I have to fill out a form with a lot of information including a price and a date. But the dates are not always added in the correct order (there may be an earlier date added after.  
So I have an INDEX column that displays a number to tell me the order of these dates.

So I try to work with these numbers to find the right order but I can’t do it.

The goal is to have the dates in the correct order so that I can add the prices in relation to these dates.  
And thus calculate the cumulative price based on the progress of these dates.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 4:18pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/2 "2024-03-27T16:18:49Z")

</div>

You should be able to adapt the solution that I gave you earlier. I think all you would need to do is add an Order By condition to the Query column.

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 4:32pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/3 "2024-03-27T16:32:10Z")

</div>

Indeed, I tried but I can’t do it.  
The difference between your example and mine is that the dates are not in order.

In fact, the form I created is linked to a client. And on this page I have a lot of information including a date and a price. But they are not in the right order

So I made a QUERY to put all the clients in order for a LOOKUP to retrieve the dates. Then I tried your solution this morning but I couldn’t do it.

So I added a column for INDEX to have the rank number of these dates.  
Then I tried your solution with that in addition but impossible…

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 4:39pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/4 "2024-03-27T16:39:21Z")

</div>

Can you show me a sample of your data?

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 4:47pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/5 "2024-03-27T16:47:16Z")

</div>

It’s in French, I hope it goes well…  
In the photo it’s almost good but the order is reversed, I don’t understand why  
And it goes from $2,000,000 to $1,800,000 when it should only increase in this specific case

 ![Capture d’écran 2024-03-27 à 17.44.26](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/c/ece0c490e3878b66a51ea7bec4861d7dba1783a6.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 4:54pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/6 "2024-03-27T16:54:11Z")

</div>

Just so I understand, you need a cumulative total per client, ordered by date, yes?

I don’t see any order values in your screenshot, are they in another table?

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 4:58pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/7 "2024-03-27T16:58:20Z")

</div>

Yes, that’s it, the cumulative total of the value of the price (which is right next to it on this same table) given to each customer but in the order of the date assigned and not the date of addition

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 5:00pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/8 "2024-03-27T17:00:35Z")

</div>

Would you mind showing me another screenshot that includes the 3 key columns - Client, Date Assigned and Amount?

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 5:05pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/9 "2024-03-27T17:05:52Z")

</div>

Of course here is the screen with the price (it is an IF because the value can be in progress or stopped so either the defined value is 0)

 ![Capture d’écran 2024-03-27 à 18.02.59](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/4/241778efcdc72988e02f6d21b4128355d68ecee3.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 5:16pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/10 "2024-03-27T17:16:04Z")

</div>

Does the below look correct?

 ![CleanShot 2024-03-28 at 01.15.35@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/0/d05a5b5e5da9aa8572657ff8963d3a91bb805046.jpeg)

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 5:31pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/11 "2024-03-27T17:31:32Z")

</div>

No unfortunately it’s not good… I made an example of what I would like as a result, I don’t know if it could help

 ![Capture d’écran 2024-03-27 à 18.30.03](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/2/12084baf06ac24149b03c660f5f539abaee75c50.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 5:34pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/12 "2024-03-27T17:34:06Z")

</div>

oh, so you _don’t_ want it by Client?

Your perfect example just appears to be in row order, with no regard for client or date?

Now I’m confused about what you actually want…

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 5:40pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/13 "2024-03-27T17:40:09Z")

</div>

Ok I must have expressed myself badly and I’m sorry…  
I really need what’s in the example. Like what you sent me this morning but sorted in date order

In the example, it is not 100% in the order of the lines, there are some which are at another level

I’m trying to get the result I want with QUERY and with the data from my example but I can’t…  
Isn’t that possible in my case?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 5:44pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/14 "2024-03-27T17:44:32Z")

</div>

Okay, so here it is ordered by Date:

The earliest date is Dec 1 (row 11), so that has the lowest cumulative total.  
And the latest date is March 5 (row 3), so that has the highest cumulative total.  
The filter on the Query column is simply “date is on or before This row → date”

 ![CleanShot 2024-03-28 at 01.41.40@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/2/4219072dc7066028fc09d9881876d70317b69585.jpeg)

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 5:49pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/15 "2024-03-27T17:49:52Z")

</div>

I get the same result  
But normally, there should only be one “Julien” at the beginning on December 1st then 2 “Julien” on December 2

And at the end of the total accumulation, it should only increase since the prices are only positive. So 1,600,000 → 2,000,000

That’s why I tried to add the rows of dates earlier but that doesn’t solve the problem.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 5:52pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/16 "2024-03-27T17:52:55Z")

</div>

I’m sorry, but I don’t understand.

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 6:02pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/17 "2024-03-27T18:02:51Z")

</div>

Columns 1/2/3 which respectively display 1,900,000 / 1,800,000 / 2,000,000 should be in this order 1,800,000 / 1,900,000 / 2,000,000.

The cumulative value in line 4 is 1,600,000.  
To this value are added:  
02/26/2024 → 100,000 therefore 1,800,000 + 100,000 = 1,900,000  
03/05/2024 → 100,000 therefore 1,900,000 + 100,000 = 2,000,000

And this is not the case and it is not logical since the last one is not the largest while all the added values are positive

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 27, 2024, 6:11pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/18 "2024-03-27T18:11:45Z")

</div>

> [@Nicolas\_Gallien](#):
>
> Columns 1/2/3 which respectively display 1,900,000 / 1,800,000 / 2,000,000 should be in this order 1,800,000 / 1,900,000 / 2,000,000.

Why?  
If they were in the order that you describe, then they wouldn’t be in date order.  
This is why I am confused. You tell me you want it in date order, but when I show you how to do that you tell me that isn’t what you want 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 27, 2024, 6:16pm UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/19 "2024-03-27T18:16:16Z")

</div>

Ok it’s my fault… the dates are in French format

February 26 → 100,000 therefore 1,800,000 + 100,000 = 1,900,000  
March 5 → 100,000 therefore 1,900,000 + 100,000 = 2,000,000

The dates are in order… that’s why I don’t understand

All this just to have a graph displayed…  
But the difference is obvious  
A camouflaged calculation with only positive values should only go up (and then whatever the date…)

 ![Capture d’écran 2024-03-27 à 19.24.39](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/8/f8d377620f1a5746bc0969f3d992883954087a96.png)

---

<div class="post-metadata">

**Author:** ![Nicolas\_Gallien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicolas_gallien/32/63156_2.png) [@Nicolas\_Gallien](https://community.glideapps.com/u/Nicolas_Gallien)\
**Post date:** [March 28, 2024, 8:05am UTC](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098/20 "2024-03-28T08:05:31Z")

</div>

I would like to try something else that might fix the problem.  
Is it possible to sort the numbers which determine the rank of a date in a new column? I got these ranks with an INDEX

So basically, can we create a new column that classifies existing numbers out of order but this time in order?

Thanks in advance.

[Next page](https://community.glideapps.com/t/ranking-by-number-for-cumulative-calculation/72098.md?page=2)
