# Lookup most frequently used

**URL:** <https://community.glideapps.com/t/lookup-most-frequently-used/34964>\
**Category:** Ask for Help\
**Created:** [November 23, 2021, 1:36pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964 "2021-11-23T13:36:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 23, 2021, 1:36pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/1 "2021-11-23T13:36:45Z")

</div>

Hi! my app has a series of user-generated data (trade type, stock symbol, open/close dates, buy/sell prices, etc.) and I’m wondering if it’s possible to display the most frequently used stock symbol in a summary table? Also, is it possible to display the symbol with the highest calculated profit along with that profit amount?

I can display trade type amounts because there are only 5 to choose from. But since the stock symbol will be different for every user, I’m having trouble figuring out how to display most frequently used per user. Thanks!

---

<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:** [November 23, 2021, 1:46pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/2 "2021-11-23T13:46:51Z")

</div>

> [@Trading\_5\_Talents](#):
>
> But since the stock symbol will be different for every user,

Is this the Symbol\_Input column in your trades table?

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 23, 2021, 2:28pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/3 "2021-11-23T14:28:36Z")

</div>

Yes and no 😀 Yes in that each user fills that out, but no in that I want to display the Symbol\_final as it shows all uppercase letters which is the conventional display.

---

<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:** [November 23, 2021, 2:53pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/4 "2021-11-23T14:53:26Z")

</div>

Okay.  
And you mentioned that you’d want to display these in a table - sort of like a “Top Ten Symbols” or something like that? I suppose there could ultimately be hundreds or even thousands of these, yes?  
I have an idea in my head how this could work, but I just want to ensure I have a clear understanding first.

As for this one…

> [@Trading\_5\_Talents](#):
>
> Also, is it possible to display the symbol with the highest calculated profit along with that profit amount?

Which column is that value taken from?

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 23, 2021, 3:37pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/5 "2021-11-23T15:37:55Z")

</div>

Yes, a “Top 10” would be awesome! OriginallyI was just thinking of the “Top 1” but a list of the top few would be better for the user. Yes, there could be hundreds of symbols.

For the profit per symbol, I don’t have a specified column yet as I didn’t know how to set it up. Right now I have columns for the symbol and profit per trade. But not one for total profit for just one symbol.

---

<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:** [November 23, 2021, 4:04pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/6 "2021-11-23T16:04:33Z")

</div>

> [@Trading\_5\_Talents](#):
>
> For the profit per symbol, I don’t have a specified column yet as I didn’t know how to set it up. Right now I have columns for the symbol and profit per trade. But not one for total profit for just one symbol.

Okay, this one is easy. All you need to do is create a self-referencing multi-relation column in your Trades table that links the symbol to itself…

 ![Screen Shot 2021-11-23 at 11.58.36 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/0/70eabc5e48ecd7f229b45ccda7592e9a3ae8ecb2.png)

… and then do a rollup through that relation, taking a sum of the profit

![Screen Shot 2021-11-23 at 11.59.02 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/9/b9f919e3c12f43ca7ec75b750eb70b9c129cc6bc.png)

That same relation can also be used to get a count of trades per symbol. But coercing that into a “Top Ten” table requires a little more work. It’s late here, so I’ll think on that one and come back to you with an option tomorrow (unless somebody else jumps in before then).

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 23, 2021, 4:14pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/7 "2021-11-23T16:14:12Z")

</div>

Thank you! I’ll try this out!

---

<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:** [November 24, 2021, 1:53pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/8 "2021-11-24T13:53:17Z")

</div>

> [@Darren\_Murphy](#):
>
> That same relation can also be used to get a count of trades per symbol. But coercing that into a “Top Ten” table requires a little more work. It’s late here, so I’ll think on that one and come back to you with an option tomorrow (unless somebody else jumps in before then).

@Trading_5_Talents - okay, I have an option for you, but I have to warn you - it isn’t simple 😛

I’m quite sure @Jeff_Hager will come along and show how to do this with about 3 columns. That’s what he usually does 🤣

Anyway - here it is…

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 24, 2021, 3:23pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/9 "2021-11-24T15:23:15Z")

</div>

Thank you! I’ll take a look into this weekend and report back. I appreciate your willingness to come up with a solution for this. 👍

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 30, 2021, 8:06pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/10 "2021-11-30T20:06:58Z")

</div>

Wow. Still trying to wrap my head around this solution 🤯 🤣

So it looks like this would be an overall list of most frequent items, which is very useful. In addition to displaying number of trades, I suppose I could rollup the total profits from each ticker symbol?

I guess the follow up question would be is it possible to sort this based on month. For example, the user selects a month and now sees top symbols for that month only with trade numbers and total profits from that symbol.

I’m using elements from your solution along with @Robert_Petitto 's leaderboard video, and I can get as far as listing top ticker symbols with total profits, but those are lifetime profits, not a user-selected month display. That seems to be my next hurdle…

---

<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:** [December 1, 2021, 1:37am UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/11 "2021-12-01T01:37:21Z")

</div>

> [@Trading\_5\_Talents](#):
>
> Wow. Still trying to wrap my head around this solution 🤯 🤣

yeah, it’s not exactly one for the feint hearted 😉  
My gut tells me that there should be a simpler approach.

> [@Trading\_5\_Talents](#):
>
> I guess the follow up question would be is it possible to sort this based on month. For example, the user selects a month and now sees top symbols for that month only with trade numbers and total profits from that symbol.

You mean _filter_ by month, as opposed to sort by month, right?

You have 95% of what you need for that in the example I gave you. All you need to do is:

- Add a user specific column to that Lookup table to hold the value of the selected month
- Add a single value column to apply that to all rows
- Create a template column that joins that single value column and the sv/symbol column
- Make sure you have a similar template in your trades column

And then everything else will work as before, except that it will be filtered by the selected month.

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [December 14, 2021, 8:01pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/12 "2021-12-14T20:01:13Z")

</div>

Hello! I think I’m understanding it now 😀

I’m able to filter the tickers by month and sum their profits in this demo app using your steps. But it’s dependent on the index column, right? I’m imagining numerous users each using a different set of stock tickers, so this would mean I need an index column of a couple of hundred rows?

Or at least have these rows added if the ticker isn’t already in the trade table?

---

<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:** [December 14, 2021, 11:37pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/13 "2021-12-14T23:37:04Z")

</div>

> [@Trading\_5\_Talents](#):
>
> I’m imagining numerous users each using a different set of stock tickers, so this would mean I need an index column of a couple of hundred rows?

As long as you’re using a user specific column to hold your filter choice, then you only need enough rows to cover the maximum number of symbols that any single user would have. Maybe that’s only a dozen or so?

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [December 17, 2021, 4:21pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/14 "2021-12-17T16:21:28Z")

</div>

I see. So I think I got it working! I was able to display it all in a table component so it matches the overall look of the app. Thanks again for all your help with this part of my app!

 ![Capture](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/f/cf931d403cf46b458f2ecbac5955a2f24c6cdab6.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [December 18, 2021, 4:21pm UTC](https://community.glideapps.com/t/lookup-most-frequently-used/34964/15 "2021-12-18T16:21:41Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
