In this example, the subtasks of the current issue, which are open - so in status category "To Do" or "In Progress" -, will be counted and displayed in a Calculated Number Field.
The configuration of this custom field will look like this:
Text to be parsed is: count(filterByPredicate(subtasks(), ^%{00144} = "To Do" OR ^%{00144} = "In Progress"))
Note that:
Adding the custom field to an issue with subtasks in different categories will look like this: