Dennis @ PerfectForms
I assume that you are asking how to do this in a form, not a report.
Create a form connection with a Read action. In the action use Meta-Stage as a send parameter and any field as a return parameter (when in doubt, I always use Meta-Instance ID). From the form instance use the connection to send the stage you are looking for and target a hidden helper table (all rows) for the return parameter. Use a Set Field with the Count Function to get your value: /Documentation/manual/html/?fg_functions_in_the_formula_editor.htm.