When creating custom stats, you can set up specific values to be dynamically replaced by the user’s selection from a pull-down menu.
The same mechanism is used in the built-in stats which have pulldowns to choose a date range, ticket property, grouping field, order, etc.
To create a pull-down menu, you need to create a variable in the stat builder for that particular stat, and then put code in two places:
First, create a variable by clicking Add Variable within the stat you want to create.
Determine the ID, this will be used to refer to the variable in the title of the stat - allowing you to create a pull down menu. It will also be referred to in the query itself.
Determine the rest of the variable criteria as necessary.
Now, add the variable ID to both the title and query.