> ## Documentation Index
> Fetch the complete documentation index at: https://docs.practicemate.com.au/llms.txt
> Use this file to discover all available pages before exploring further.

# Find frequent visitors

> Build a Recipe for patients with three or more visits in the last two years.

This guide builds on the first Recipe and adds a more powerful idea: an **ingredient**.

You will find:

**Active male patients aged 50 or older who have had 3 or more visits in the last 2 years.**

This is only an example. Your practice might use the same pattern to find patients with a certain number of visits, prescriptions, observations, reports, reminders, appointments, or other related records.

## Start with the first Recipe

Begin with the Recipe from [Create your first Recipe](/recipes/first-recipe):

* Status is Active
* Extraction Opt-Out is False
* Age (Years) is greater than or equal to 50
* Sex is Male

Then add the visit-history ingredient below it.

<img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/first-recipe-complete.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=4d10d7e5c76072d530f709644fb96c39" alt="The first Recipe completed with the default patient filters, Age (Years) is greater than or equal to 50, and Sex is Male." className="rounded-lg border" width="1110" height="520" data-path="images/recipes/first-recipe-complete.jpg" />

## Add a Visits ingredient

<Steps>
  <Step title="Select Add Ingredient">
    Under the patient filters, select **Add Ingredient**.

    <img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/ingredient-empty.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=2c267a66ec1d7bd1e7734f0cde84be56" alt="A new ingredient card below the patient filters, starting with 'Where each patient' and a relationship chooser." className="rounded-lg border" width="1110" height="810" data-path="images/recipes/ingredient-empty.jpg" />
  </Step>

  <Step title="Choose the relationship">
    In the relationship box, choose **has a count of**.

    <img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/ingredient-relationship-menu.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=77323f74c43fc5426d747ba06ed150c9" alt="The ingredient relationship menu showing has any, has no, only has, has a count of, and has an average." className="rounded-lg border" width="220" height="250" data-path="images/recipes/ingredient-relationship-menu.jpg" />
  </Step>

  <Step title="Set the count">
    Choose **at least**, then enter **3**.
  </Step>

  <Step title="Choose the related table">
    Select **Visits**.

    <img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/choose-visits-table.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=7bb4f721fe13ee4477c4e86d9070da79" alt="The related table chooser showing Visits." className="rounded-lg border" width="270" height="220" data-path="images/recipes/choose-visits-table.jpg" />
  </Step>
</Steps>

At this point, the ingredient says:

**Where each patient has a count of at least 3 Visits where...**

The "where..." part is important. Without it, PracticeMate would count all visits, not just recent visits.

<img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/visits-count-ingredient.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=0b7cc07b1d756cb52546572d9008089b" alt="The Visits ingredient showing has a count of at least 3 Visits, before the Visit Date filter is added." className="rounded-lg border" width="1110" height="810" data-path="images/recipes/visits-count-ingredient.jpg" />

## Limit the count to the last two years

Add a filter inside the Visits ingredient:

<Steps>
  <Step title="Select Add Filter inside the Visits ingredient">
    Use the **Add Filter** button inside the Visits card, not the one in the Patients section.
  </Step>

  <Step title="Choose Visit Date">
    Select **Visit Date**.
  </Step>

  <Step title="Choose the date operator">
    Select **is greater than or equal to**.
  </Step>

  <Step title="Enter the relative date">
    Type **2 years ago** in the value box. If PracticeMate offers a relative-date suggestion, choose it.

    <img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/relative-date-suggestion.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=4c92148fb142ff5c173864687786fbe2" alt="The Visit Date value box showing a relative-date suggestion for 2 years ago." className="rounded-lg border" width="1000" height="340" data-path="images/recipes/relative-date-suggestion.jpg" />
  </Step>
</Steps>

Your Recipe should look like this:

<img src="https://mintcdn.com/practicemate-6786ac90/PV9Jkc_3uoV9ywOH/images/recipes/complex-recipe-complete.jpg?fit=max&auto=format&n=PV9Jkc_3uoV9ywOH&q=85&s=c148e7badba3ba871346e1d411f91c3a" alt="The Recipe Builder showing patient filters plus a Visits ingredient with a count of at least 3 and Visit Date set to 2 years ago." className="rounded-lg border" width="1095" height="805" data-path="images/recipes/complex-recipe-complete.jpg" />

## Read the Recipe back

Before testing, read the Recipe in plain English:

> Find active patients who have not opted out, are male, are aged 50 or older, and have at least 3 visits where the visit date is within the last 2 years.

That read-back is a useful habit. If the sentence sounds wrong, the Recipe probably needs adjusting.

## Test before saving

Select **Test**.

If the result is unexpectedly high, check that **Visit Date** is inside the Visits ingredient. If the result is unexpectedly low, check that the relationship says **has a count of at least 3**, not **has any** or **has no**.

<Note>
  The Visits filter belongs inside the ingredient because it controls which
  visits are counted. A Visit Date filter outside the ingredient would be a
  different kind of Recipe.
</Note>

## Save the Recipe

Use a name that explains the purpose:

**Active male patients aged 50+ with 3+ visits in 2 years**

Then select **Save**.

<Tip>
  For Recipes that will be used by other team members, include the timeframe in
  the name. "3+ visits in 2 years" is clearer than "frequent visitors".
</Tip>

Because this Recipe has more moving parts, Version history can be especially helpful. If your team later adjusts the visit count, timeframe, or ingredient, the previous saved version remains available so you can review it and restore it if needed.

Older versions remain available for 365 days.

## What you learned

You used:

* **Add Ingredient** to look at related records
* **has a count of** to count those related records
* **at least 3** to set the minimum count
* **Visits** as the related table
* **Visit Date** to limit which visits are counted
* a relative date, **2 years ago**

The same pattern works for many Recipe questions: choose the related record type, choose whether the patient must have it, must not have it, or must have a certain number of it, then add filters inside that ingredient.
