# Limit number of item for charts

**URL:** https://community.glideapps.com/t/limit-number-of-item-for-charts/18811
**Category:** Ask for Help
**Created:** [November 23, 2020, 1:07pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811 "2020-11-23T13:07:02Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 1:07pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/1 "2020-11-23T13:07:02Z")

</div>

Hey,

I’m building a workout app (callisthenic 🦾)

> **[Callisthénie](https://callisthenie.glideapp.io/)**
>
> Débuter la callisthénie avec ce programme d'entrainement par Simon Hamptaux.

When I’m done with the sets per exercice, I submit a form to enter the number of rep per set per exercice. Automatically, it registered the date.

 ![Capture d’écran, le 2020-11-23 à 07.54.26](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/0/80708c94e446f6cd668794ab70b3178000650339.jpeg)

Once submit, results are compiled in a new tab (‘‘accomplissements’’ sorry french) in the Sheet and the app.

 ![Capture d’écran, le 2020-11-23 à 07.55.14](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/2/b2895559be567750b7e407c8ce31716b2248b76b.png)

I also add a chart in the exercice page (see in this example the ‘‘Push-up (incliné)’’ page). The chart show the number of reps for the last days. So I know how many reps minimum I have to do and be better every time.

BUT (here’s the question lol), I want to only show 7 days maximum. Because if I show 8+, the chart is too messy and I can’t see anything.

 ![Capture d’écran, le 2020-11-23 à 07.55.58](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/0/f04906ffaa7cf12fa31e202760f2ecf62d1626dc.png)

I tried everything but I can’t figure out the right filter to use.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [November 23, 2020, 1:27pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/2 "2020-11-23T13:27:39Z")

</div>

In the data, create a math column that takes the date and adds 7. Then add a filter to the chart that will only show data when the math column is “On or After” Today.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 1:36pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/3 "2020-11-23T13:36:15Z")

</div>

Like that?

 ![Capture d’écran, le 2020-11-23 à 08.32.31](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/1/712df606936f065fbb40319c14a570c2486db083.png)

 ![Capture d’écran, le 2020-11-23 à 08.33.12](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/1/f199dccd6dbfe5ab1ce7fac7ee12a57010d10d0b.jpeg)

It doesn’t work.

I want to add the info that I don’t workout each day so it’s not ‘‘Last 7 days’’. Maybe the 7th days is one month ago.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 23, 2020, 1:37pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/4 "2020-11-23T13:37:31Z")

</div>

Probably you would need a custom ranking formula in the sheets to rank the days and then display the count of max items for your profile minus 7.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 3:26pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/5 "2020-11-23T15:26:49Z")

</div>

Yes I thought about that but I don’t know what formula to use. I’ll dig, thanks!

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 23, 2020, 4:23pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/6 "2020-11-23T16:23:17Z")

</div>

You do need to rank by each user, is that correct? I might have a custom function to help you in the Sheets.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 4:35pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/7 "2020-11-23T16:35:57Z")

</div>

For now, the app is made for one user (the creator). There is no Row Owner yet. No sign in!

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 23, 2020, 4:59pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/8 "2020-11-23T16:59:27Z")

</div>

> **[RANK - Docs Editors Help](https://support.google.com/docs/answer/3094098?hl=en)**

So can you please try this and let me know if it helps? I’ll jump in if you need further assistance.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 6:09pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/9 "2020-11-23T18:09:43Z")

</div>

It works! In fact, I can do it manually but my arrayformula does not seem to work.

Here’s the formula if I do it manually with for example 9 dates.

`=RANK(A2,A$2:A)`

 ![Capture d’écran, le 2020-11-23 à 13.04.19](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/0/6005556d964e6dfdf674ed425759511bb26fa9a7.png)

but If I want that the formula work on a new value added in the app, I would use something like

`=ARRAYFORMULA(IF(A2:A="","",RANK(A2,A2:A)))`

And it doesn’t work… what’s the issue?

 ![Capture d’écran, le 2020-11-23 à 13.04.35](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/0/d0f3f07310fc3f90bf842ab18e8a6e799f820764.png)

Here’s the filter in the chart… that part works just fine 🙂

 ![Capture d’écran, le 2020-11-23 à 13.05.04](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/d/cdb6c1fd5e3c92de9b4af48f7a501ab47d15a9ec.png)

---

<div class="post-metadata">

### Author: ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)
#### Post date: [November 23, 2020, 7:14pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/10 "2020-11-23T19:14:30Z")

</div>

Salut franck  
Pour une fois qu’il y a des Français on ne va pas se priver 😀  
Le probleme dans ton arrayformula c’est dans rank tu as déjà une matrice A2:A. Je te conseille de nommer la plage A2:A  
Ta formule sera alors  
=arrayformula(si(A2:A=“”;””;rank(A2:A;plage nommée))

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 7:28pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/11 "2020-11-23T19:28:20Z")

</div>

Salut! Oui on va parler en français 😃

`=arrayformula(si(A2:A=“”;””;rank(A2:A;plage nommée)))`

Je ne suis pas certain de comprendre pour rank.

`rank(value, data)`

`Value`, tu me dis de mettre `A2:A` ?  
`Data`, tu me dis de mettre quoi ?

---

<div class="post-metadata">

### Author: ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)
#### Post date: [November 23, 2020, 7:32pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/12 "2020-11-23T19:32:43Z")

</div>

Oui dans arrayformula une cellule devient une plage de cellule et donc ton probleme c est qu’ensuite ton data qui est déjà une plage ne peut pas changer de dimension d’où la nécessité de nommer la plage.

Pour être clair  
Sans arrayformula  
= si(A2=“”;””;rank(A2;A2:A))

Avec arrayformula  
= arrayformula(si(A2:A=“”;””;rank(A2:A;plage nommée)

Et dans Google sheet tu vas dans le menu données et plages nommées.  
J’espère que c’est plus clair 😉

Regarde le support de Google sheet pour les plages nommées. C’est l’astuce normalement.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 8:35pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/13 "2020-11-23T20:35:59Z")

</div>

Merci! Ca semble bien marché avec la formule `=ARRAYFORMULA(SI(A2:A="","",RANG(A2:A,A2:A)))`

Maintenant, j’ai un autre problème que j’avais oublié. Je dois classer les rank par exercices. Par exemple, j’ai ai 10 exercices ‘Push-up (incliné)’, jusque là ça va.

 ![Capture d’écran, le 2020-11-23 à 15.32.59](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/e/ae3e1b5eff43735441c972cc41a46f2d542023e1.png)

Mais si j’ajoute un autre exercice, le rank ne voit pas la différence.

 ![Capture d’écran, le 2020-11-23 à 15.33.46](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/b/dbf54a4b40056a5d015898c873cdb14eeb8d2340.png)

Comme le nouvel exercice se retrouver #1. Il me reste 6 exercices dans mon chart 🙃

 ![Capture d’écran, le 2020-11-23 à 15.35.00](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/a/5af287f82f269740faad8f5aa042bde96452e548.png)

Il y a un moyen d’ajouter une fonction ‘par catégorie’ dans la formule?

---

<div class="post-metadata">

### Author: ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)
#### Post date: [November 23, 2020, 9:03pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/14 "2020-11-23T21:03:20Z")

</div>

Oui tout à fait … we can switch to English 😉 this is easier to explain.

You can use the filter function inside the rank function.  
But you would need to add a value to know which exercice to filter.  
To do so you would need to have a specific column for each exercice and the name of the column would be the value in the filter. This solution should work but not very Good in the long term.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 23, 2020, 9:33pm UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/15 "2020-11-23T21:33:29Z")

</div>

Oh I understand. What would be the best solution in the long term?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 24, 2020, 12:01am UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/16 "2020-11-24T00:01:02Z")

</div>

So has the situation been solved? I can share my script if the original Rank doesn’t work.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 24, 2020, 12:19am UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/17 "2020-11-24T00:19:29Z")

</div>

Yes it worked for all exercices using `=ARRAYFORMULA(SI(A2:A="","",RANG(A2:A,A2:A)))`

Now, I need to filter them. Because, if I have, for example, 7 ‘‘push-up’’ and I add ‘‘2 abs’’, it will count as 9 push-ups instead of 7 so the rank will not be right.

I checked the filter formula but it’s more complicated now if I have to add new columns for each exercice like @Marc-Olivier explained.

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 24, 2020, 2:27am UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/18 "2020-11-24T02:27:13Z")

</div>

Ok I found the solution. Not the easiest but it works.

As each exercice is different, I will create a different screen configuration in my inline list.

 ![Capture d’écran, le 2020-11-23 à 21.24.14](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/4/4489f2485314702205c3d42b713fe890380df6b5.jpeg)

Then on my sheet, I will create a tab per exercice. When I submit the form after each set, it will link to their tab.

I wish there was a way to at least copy a screen configuration so I don’t start from scratch each time 😅 (20 screens to do!).

* * *

Thanks all, you helped me with the rank formula 🔥

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 24, 2020, 8:49am UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/19 "2020-11-24T08:49:49Z")

</div>

So you need a ranking formula that lives in the same sheet with multiple types of work out challenges and it needs to be ranked based on each work out type, right?

---

<div class="post-metadata">

### Author: ![F\_rank](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/f_rank/32/30511_2.png) [@F\_rank](https://community.glideapps.com/u/F_rank)
#### Post date: [November 24, 2020, 11:50am UTC](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811/20 "2020-11-24T11:50:09Z")

</div>

Exactly! If you find it, you’re the best!

[Next page](https://community.glideapps.com/t/limit-number-of-item-for-charts/18811.md?page=2)
