Create a virtual column using sum and rest between two tables. One to many

See

4 Likes

I’d much rather see the use of references between Orders table and the Item table

  • this would remove the need for a hard-coded SELECT() and would instead run on the efficient REF_ROWS() built by the system.

Then your formula would look like this…

[Units]
-  SUM([Related Orders][Units])

…and would be much more efficient. If you plan on accumulating a decent amount of records, that SELECT() will come back and bite you - FYI.

5 Likes

Yeah, you right… Works the same for me, but this is much easier and efficient, Thank you.

[Units]

  • SUM(Orders[Units])

But… that doesn’t take into consideration WHICH item it should be pulling the [Unit] value for. :biohazard:
That will pull the complete list of every value in the table… and sum them all.

So if you’re looking for a grand total of every [Unit] value added together, that’s the way to go.

  • But if you need things filtered specific to the [ItemID] - you’ll have to include the SELECT()

References my friend

  • On the Order table, create a reference to the Items table - you likely already have a field were people can select the item (or items).
2 Likes

Very good tips @Denis_Sanchez_Leyva

Thanks Guy, I am new with AppSheet. I only tried to do that task for my own. I know is a long trip but I made what I wanted to do. Again Thank you very much.

3 Likes