What is the best approach?

I have a Google Spreadsheet that I have been using for 2 years…in the spreadsheet I calculate the rate of weight gain of my pigs. In my spreadsheet each animal has its own sheet and each row entered is a new date and weight with calculations dependent on the row above. The calculations are: difference in weight since last weigh in, average gain per day, number of days till show and projected weight at that target show.

Here is my spreadsheet (I know its messy): https://docs.google.com/spreadsheets/d/10CZh1t5KKpWHoCx1MfA7s22yJ1465aN146j4BEVDlYs/edit?usp=sharing

I realize that each table in appsheet relates to each sheet in google sheets, so I made a table called Pigs. And a table called weigh in as the table with the formulas.

Problem is when I add a new weigh in, even referencing the pigs, it still calculates that new entry based on the previous entry which could have been a completely different pig.

It does reference the pig, but will have the completely wrong numbers associated with it.

I’ve tried so many different things to get it to filter only pigs with the same name and I can’t get the calculations to work.

Was thinking today, maybe I could use slices to filter new rows only applying to that particular pig? Even then I’m not sure where to add formulas and exactly what those formulas should look like.

Once I figure that part out then I have to move to the next step of projecting weight based on target show dates and how many days till a show.

Thanks for any help!