Removing duplicates from a column

Hi, I have a transaction dataset where a user is transacting on different assets. Now, i want to create a portfolio level view and therefore, figure out a list of assets in the portfolio from the transaction. How can I do that as I am not able to find a single function which can remove the duplicates in a column?

Also, there is a second step to it - once I figure out the above, I need to be able to calculate the holdings for a particular asset from the transaction - any idea how to do that?

Example dataset -

Transactions -
1 - GOOGL - BUY - 100 units - $20000
2 - GOOGL - BUY - 100 units - $15000
3 - AMZN - BUY - 100 units - $10000
4 - AMZN - BUY - 100 units - $15000
5 - AMZN - SELL - 50 units - $5000

Portfolio -
GOOGL - 200 units
AMZN - 150 units

P.S. I am using Glide Tables so the approach needs to be accordingly, thank you!

  • Create a multiple relation column that matches the stock symbol to itself.
  • Now you can use a rollup column that takes a sum of units via that relation.

Alternatively, you could create a separate table with a column containing a list of stock symbols, and build the relation + rollup in that table. It would be possible to dynamically generate the list of symbols if that’s the approach you want to take. (Ask if you want to know how).

2 Likes

Some additional information to eliminate the duplicates.

2 Likes

hi @Darren_Murphy

Thank you so much for this trick, I was able to solve the problem!!

Can you help me with this issue? So I have created the portfolio table which lists out all the assets for 1 user. Its user specific.

Lets say 1 user has 5 assets in his portfolio. Now, if i login using another user, I see 5 blank rows in the inline list. This is so weird.

It’s a bit difficult to say what’s going on there without seeing how the Inline List is configured, and what the underlying data looks like. Could you add screen shots that show each of those?

So I have 2 tables - Transaction and portfolio

Transaction table contains the transactions added by users

Portfolio table rolls it up at portfolio level to calculate totals etc.

The inline list picks up the portfolio table to display few values

It’s not something simple like the Inline List picking up rows with no values, is it?
Maybe you just need a filter on your inline list to make it exclude empty rows?

So these are not empty rows, these have values from different users. When I log in as a user i can see the values in the frontend. I guess Glide is hiding the inputs in the tables and that’s why its appearing as empty.
However, the inline list is picking up these empty rows and showing them as well to another user, which is weird.

Yes, that’s expected. The only thing that would prevent that would be if you were using Row Owners.
Because you have a RowID in the Portfolio table, Glide will consider all rows as populated, even if every other column is empty. So in the absence of any filters, you will see every row in your inline list regardless of which user you view as.

I think you just need to add a filter to your Inline List. Something like “where Name is not empty”.

1 Like

Yes the filter helped. Visibility does not really work. I think visibility check is on the Frontend in Glide; therefore, it does not see any data and hides the display. It should have been a backend check I suppose.

However, the filter worked.

Here is the app if you want to check it out https://cryptfolio.glideapp.io/

Thanks for your help!

1 Like

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