# Relation + Rollup question

**URL:** <https://community.glideapps.com/t/relation-rollup-question/15623>\
**Category:** Ask for Help\
**Created:** [September 11, 2020, 1:36am UTC](https://community.glideapps.com/t/relation-rollup-question/15623 "2020-09-11T01:36:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spencersRus](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/spencersrus/32/69_2.png) [@spencersRus](https://community.glideapps.com/u/spencersRus)\
**Post date:** [September 11, 2020, 1:36am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/1 "2020-09-11T01:36:24Z")

</div>

I am playing around (and learning) with creating an app here.  
Here is a link to the copyable app: [https://needed-wash-9803.glideapp.io/](https://needed-wash-9803.glideapp.io/)

Sheet1 is a list of stocks the signed in user can choose from (a trading floor)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/1/166b7867ba7523d0ce8626a330704b17bd36e8a7.png)

Sheet2 is a list of transactions when a user ‘buys’ (or sells) stocks.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/b/babbd9d41d36fc00bc8fe5ce9a03de0ee663be65.png)

**Back n SHEET1 (the trading floor) I need a relation and a rollup that will count the number of each stock the SIGNED IN USER has in their portfolio.**

So kevin would have 10-2=8 Apple shares and martha would have 1-2=8 Coke shares and 4 apple shares. I would even take two columns of “total bough” and “total sold” and then I could do a math column to subtract. So far I have only gotten a rollup of all shares bought regardless of signed in user to happen.

After watching @Robert_Petitto’s videos on inventory and dropping…  
I have played around with adding a “signed in user” column in Sheet1 to do a relation to the transactions. But I just cannot get it to go.  
But this is a bit different because they are selling (dropping or using) ‘part’ of what they bought, so a switch does not seem to work.

Any help with a relation or lookup or rollup?

---

<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:** [September 11, 2020, 1:51am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/2 "2020-09-11T01:51:03Z")

</div>

Hi Kevin, is this what you expect it to be?

Signed in as [kevin@spencersrus.com](mailto:kevin@spencersrus.com).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/2/292462c914eb4eced83b6cc47139f0125044a980.png)

Signed in as [martha@spencersrus.com](mailto:martha@spencersrus.com).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/c/c95deca08b2b4bcc5055b46c2073ff41b0694da8.png)

---

<div class="post-metadata">

**Author:** ![spencersRus](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/spencersrus/32/69_2.png) [@spencersRus](https://community.glideapps.com/u/spencersRus)\
**Post date:** [September 11, 2020, 1:52am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/3 "2020-09-11T01:52:50Z")

</div>

Yes! That is what I wanted and have spent hours trying to figure out! #genius!

Tell me how!

---

<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:** [September 11, 2020, 1:54am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/4 "2020-09-11T01:54:10Z")

</div>

[https://subtle-request-8473.glideapp.io/](https://subtle-request-8473.glideapp.io/)

Here, you can copy it back. Let me know when you’re done so I can delete it at my end.

The key is to make a template column joining the email & the company so you can have a unique combination.

> [@spencersRus](#):
>
> So far I have only gotten a rollup of all shares bought regardless of signed in user to happen.

The unique combination prevent the problem above.

Then I make two rollups to bring back the ins and outs and a math column to finish it.

---

<div class="post-metadata">

**Author:** ![spencersRus](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/spencersrus/32/69_2.png) [@spencersRus](https://community.glideapps.com/u/spencersRus)\
**Post date:** [September 11, 2020, 1:59am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/5 "2020-09-11T01:59:51Z")

</div>

all copied on my end!

Thanks a bunch!

BTW I found this today in my alerts  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/4/4bb3c22c2c88c27e9908a9b2d16cfb795e505b3d.png)

---

<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:** [September 11, 2020, 2:00am UTC](https://community.glideapps.com/t/relation-rollup-question/15623/6 "2020-09-11T02:00:53Z")

</div>

Ha, you’re also one of the first ones here and still around. Congrats on the anniversary my friend 😍

Do let me know if I can help more.
