Without fully testing this myself, here is how I would approach this problem. If I simply want to assign the result to a variable for use in a form using a procedure I would first get the year to search either with a gettext or possibly a popup menu button on the form.
gettext "Enter year…",theYear
Next I would get the various related values from the Amount and Time fields of the two databases and total them and then divide them for a final result in a variable I call finalFigure.
You could also just daisy-chain this all together an use it as a formula for your Text Display Object as long as you have the proper year set in the theYear variable:
The Text Display should update any time you change the value of theYear and use
showvariables theYear. As I said to start with, I have not fully tested this so you might need some adjusting.