Calculating count when 1 value exceeds another

I’ve been stuck on this issue for awhile now and can’t seem to get around it.

I am building a sport league app for me and my friends. There is a leaderboard which will show the total number of wins, draws, loses, etc, etc. Currently I have a data type that has a list of match ups with fields for home goals and away goals. My goal is to be able to calculate the total number of wins by any given team and display this in my leaderboard associated to the respected team.

I have UI with 2 input fields for the match ups where the user can input the home and away goals.

Anyone have any suggestions on how to calculate this?

Calculate what exactly? The winner based on the two input fields?

You’d need to know which team the input field is related to, which isn’t too hard. Then you need to use the math operators to do input A - input B or you could do workflow actions to save the ‘winner’ and ‘loser’ based on conditionals of when input A> input B team A is winner and team B is loser and vice versa.