This can be achieved in a sales order query however ONLY if you need the registrant name. If you need additional information such as registration information, the below steps may return duplicate results. If you need that information as well, you will instead want to use an export process.

Start your query:
  1. Navigate to Analysis, then click Information library
  2. Click Add an ad-hoc query
  3. Select source view of Sales Orders and click OK

Add fields to Include records where:
  1. In the left column, expand Sales Order Item, expand Sales Order Item Ticket, and select Program. From the middle, drag Program record into Include records where. Set Equal to the pre-registered program.

Add fields to Results fields to display:
  1. Within Results fields to display, highlight Lookup ID and click the red X to Delete
  2. In the left column, expand Sales Order Item, expand Sales Order Item Ticket, select Program Events. From the middle, drag Event record into Results fields to display.
  3. Within Results fields to display, highlight the Event record line. Click the SUM button and select COUNT.

Save your query:
  1. Click Set save options tab
  2. Name query
  3. Save and Close

Your final query will look similar to this:
User-added image

Note: If this not a free program and you are charging per discount, you can instead create a smart field to show number of visits along with cost.