
Amplitude's Historical Count feature helps you achieve a deeper level of understanding when you're investigating why your users are retaining, converting, or engaging—or why they're failing to do that.

{% callout type="note" %}
This article is second in a series about Historical Counts. If you haven't done so already, read [Historical Count, part 1: Track user behavior for different instances of each user action](/docs/analytics/historical-count-1). 
{% /callout %}

## Historical Count in the Amplitude order of operations

Whenever Amplitude applies filters to an event (including filters in segments), it does so in a specific order. **The Historical Count filter is always applied last**.

Consider the following example.

With the Historical Count filter applied, this chart doesn't show everyone whose third time triggering that event happened in Germany. Instead, it shows the third Germany-located instance of that event. Both previous instances also took place in Germany. The event could be the user's third, eighth, or hundredth time performing that event overall, as long as it was their third Germany-located instance.

{% callout type="note" %}
Any group-bys apply to the first event selected in the Funnel Analysis, Pathfinder, and Retention Analysis charts. When you apply a group-by, Amplitude shows the user's property value at the time the user triggers the event for the Nth time.
{% /callout %}

## Event Historical Count

The Event Historical Count filter works very similarly to the Historical Count filter. While both capture a user's Nth instance of performing a specified action, Historical Count is applied **after** all other filters have been applied. By contrast, Event Historical Count is applied **first**, **before** any other filters.

This can have important implications for your analyses. Let's use the table below to illustrate the difference:

| **Time** | **Maya’s event** | **Loc’s event** |
| -------- | ---------------- | --------------- |
| 1        | run              |                 |
| 2        | walk             | walk            |
| 3        |                  | run             |

If you set up an event segmentation analysis that searches for `Any Event` where:

- `Historical Count` = `1st`.
- `Event Name` = `Run`.

This yields two results: Maya at time 1, and Loc at time 3.

{% callout type="note" %}
While you can use "Any Event" or "Any Active Event" with Historical Count in Event Segmentation charts, you can't use these event types with Historical Count when creating dynamic cohorts in Cohort Builder. If you create a cohort using "Any Event where Historical Count = 1", it becomes a static cohort rather than a dynamic one.
{% /callout %}

By contrast, consider a similar analysis that searches for `Any Event` where:

- `Event Historical Count` = `1st`.
- `Event Name` = `Run`.

This gives you only one result: Maya at time 1. This is because `Run` is Loc's **second** event, and the Event Historical Count filters out everything but first events.

## Historical Count and custom events

Amplitude considers the custom event logic before the Historical Count filter and counts all underlying events triggered by the user.

For example, imagine a `custom_event_c`, that is triggered when a user triggers **either** `event_a` **or** `event_b`. Let's say that the user triggers events on the following days: 

**Day 1:** `event_a`

**Day 3:** `event_b`

**Day 7:** `event_b`

**Day 14:** `event_a`

If you apply the Historical Count filter of 1 to `custom_event_c` within the time frame, Amplitude counts the user in the data point for **Day 1** because `event_a` was triggered for the first time on that day. Amplitude doesn't count the user's events triggered on **Day 3**, **7**, and **14** for those days.

When you apply the Historical Count filter of 2 for `custom_event_c`, Historical Count registers **Day 3** as the day on which `custom_event_c` was triggered for the second time.

Continue on with the third article in the Historical Count series: [Historical Count, part 3: Funnels and behavioral cohorts](https://help.amplitude.com/hc/en-us/articles/21065498729243).
