> For the complete documentation index, see [llms.txt](https://flapjax.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flapjax.gitbook.io/docs/reporting/data-sources-and-metrics.md).

# Data Sources & Metrics

### Data Sources

Every report starts with a data source, the pool of records it analyses.

* **People**, your contact database. It holds built-in fields such as External ID, First Name, Last Name, Email and Mobile Number, plus every custom attribute you added.
* **Stacks**, any of your custom data tables. Each stack carries its own attributes.
* **Lists**, the items of one [list](/docs/your-data/lists.md). The fields available are the list's own attributes plus the parent entity's fields. That lets you report on the working state you keep in a list, such as stage, owner or priority, rather than on the underlying person or record alone.

***

### Filtering

Add filter rules after choosing a data source to narrow which records count. The filter uses the same rule builder as segments: choose a field, an operator and a value. Add as many rules as you need and combine them with AND or OR.

Click **Add filter** beneath the data source, build your conditions, then click **Apply**. The report then counts matching records alone.

***

### Target Entities

Insight reports run cross-entity analysis through the **Target** setting. You start with one data source and measure a related entity.

Take a Stack of orders as your data source. Target the linked People and you count how many unique customers placed orders. Start from People instead and you can target a related Stack to aggregate values from linked records.

**Available targets depend on your data source:**

* From **People**, target any Stack carrying a person attribute that links back to People.
* From a **Stack**, target People, where the stack has a person attribute, or another Stack with a relationship attribute linking to the source stack.
* From a **List**, target nothing. A list report aggregates its own items, so the Target setting stays out of the way.

A selected target switches the metric options to the target's fields rather than the source's. You can add separate filter rules to the target entity too.

***

### Aggregation Metrics

The metric sets what calculation runs on the data. The options follow the field type and the report type.

#### Numeric Fields

For integer and decimal fields:

| Metric         | Description                                                   |
| -------------- | ------------------------------------------------------------- |
| **Count**      | Number of records                                             |
| **Sum**        | Total of all values                                           |
| **Average**    | Mean of all values                                            |
| **Min**        | Smallest value                                                |
| **Max**        | Largest value                                                 |
| **P10 to P99** | Percentile values: 10th, 25th, Median, 75th, 90th, 95th, 99th |

{% hint style="info" %}
**Note:** percentiles cover Insight reports alone. Historical reports support Count, Sum, Average, Min and Max.
{% endhint %}

#### Boolean Fields

For true/false fields, in Insight reports alone:

| Metric            | Description                                |
| ----------------- | ------------------------------------------ |
| **True Count**    | Number of records where the value is true  |
| **False Count**   | Number of records where the value is false |
| **Empty Count**   | Number of records with no value            |
| **Percent True**  | Percentage of records that are true        |
| **Percent False** | Percentage of records that are false       |

#### Date Fields

For date and timestamp fields, in Insight reports alone:

| Metric              | Description                                      |
| ------------------- | ------------------------------------------------ |
| **Earliest**        | The oldest date in the dataset                   |
| **Latest**          | The most recent date                             |
| **Non-empty Count** | Number of records that have a date value         |
| **Range (seconds)** | The span between earliest and latest, in seconds |
| **Range (days)**    | The span between earliest and latest, in days    |

***

### Field-Type Metric Catalogue (Aggregate Records)

The metrics above are what the **report builder** offers for aggregating a numeric field or counting records.

The **Aggregate Records** automation action goes further. It, and the record-metrics engine behind it, can summarise a field of *any* data type and write the result back into your automation. The metric set available follows the field's data type.

Use this catalogue as you build aggregation actions, or as a reference for the summaries the platform can compute per type.

#### Text, Select, Multi-select, Labels, and other text-like fields

This covers text, select, multi-select, labels, country, currency, source type, label category, mobile number and mobile prefix fields. Multi-select and label values get flattened, so each individual value counts.

| Metric             | Description                        |
| ------------------ | ---------------------------------- |
| **Most Frequent**  | The value that appears most often  |
| **Least Frequent** | The value that appears least often |
| **Distinct Count** | Number of unique non-empty values  |
| **Empty Count**    | Number of records with no value    |

#### Person fields

For a person-reference field.

| Metric             | Description                          |
| ------------------ | ------------------------------------ |
| **Distinct Count** | Number of unique people referenced   |
| **Empty Count**    | Number of records with no person set |

#### Stack (single-relation) fields

For a field that links to a record in another stack.

| Metric             | Description                              |
| ------------------ | ---------------------------------------- |
| **Distinct Count** | Number of unique linked records          |
| **Empty Count**    | Number of records with no link set       |
| **Most Frequent**  | The linked record referenced most often  |
| **Least Frequent** | The linked record referenced least often |

#### Numeric fields (extended)

Integer, decimal and time-of-day fields support the full statistical set, well beyond Sum, Average, Min and Max.

| Metric                             | Description                                              |
| ---------------------------------- | -------------------------------------------------------- |
| **Count (Non-Empty)**              | Number of records that have a numeric value              |
| **Sum**                            | Total of all values                                      |
| **Average / Mean**                 | Mean of all values                                       |
| **Minimum / Maximum**              | Smallest and largest value                               |
| **Percentiles**                    | 10th, 25th, 50th, 75th and 99th percentile               |
| **Median**                         | The middle value, the 50th percentile                    |
| **Interquartile Range (IQR)**      | The spread between the 25th and 75th percentiles         |
| **Std Dev (Population / Sample)**  | Standard deviation                                       |
| **Variance (Population / Sample)** | Variance                                                 |
| **Median Absolute Deviation**      | A spread measure around the median that resists outliers |
| **Skewness**                       | How asymmetric the distribution is                       |
| **Kurtosis**                       | How heavy-tailed the distribution is                     |

#### Boolean fields (extended)

| Metric           | Description                                    |
| ---------------- | ---------------------------------------------- |
| **True Count**   | Number of records where the value is true      |
| **False Count**  | Number of records where the value is false     |
| **Empty Count**  | Number of records with no value                |
| **Percent True** | Percentage of non-empty records that are true  |
| **Most Common**  | Whether true or false is the more common value |

#### Date and Date-time fields (extended)

Date and date-time fields support a rich set of temporal summaries. Date-time fields add **Most Common Hour** and **Nighttime Percentage** on top.

| Metric                                      | Description                                                                                   |
| ------------------------------------------- | --------------------------------------------------------------------------------------------- |
| **Earliest / Latest Date**                  | Oldest and most recent value                                                                  |
| **Date Range (Days)**                       | Time span between earliest and latest, in days                                                |
| **Midpoint Date**                           | The date halfway between earliest and latest                                                  |
| **Time Since Earliest**                     | How long ago the earliest value was, in seconds, minutes, hours, days, weeks, months or years |
| **Time Since Latest**                       | How long ago the latest value was, in the same units                                          |
| **Most Common Day of Week**                 | The weekday values fall on most often                                                         |
| **Most Common Month**                       | The month values fall in most often                                                           |
| **Weekday / Weekend Percentage**            | Share of values falling on weekdays vs weekends                                               |
| **Regularity Index**                        | How evenly spaced the values are, where higher means more regular intervals                   |
| **Interval: Avg / Median / Min / Max**      | Gap between consecutive values, in seconds, minutes, hours, days or weeks                     |
| **Most Common Hour** *(date-time only)*     | The hour of day values occur most often                                                       |
| **Nighttime Percentage** *(date-time only)* | Share of values occurring overnight, midnight to 5am                                          |

{% hint style="info" %}
The field's data type decides the exact metrics you see as you build the action. Multi-relation and label fields cannot serve as the grouping dimension in reports, and their values still count as text-like metrics here.
{% endhint %}

***

### Grouping

A **Grouped by** attribute breaks your data into categories. Group people by country, for instance, and you get a bar per country. Most attribute types work for grouping. Multi-relation and label fields do not.

With no grouping applied, an Insight report shows a single metric. Add grouping and the result becomes a chart.

**Include empty values** decides whether records with no value for the grouping attribute form their own group.

***

### Segmentation

A **Segment by** attribute cross-tabulates your data. Segmentation adds a second dimension, splitting each group by the segment attribute's values.

In Insight reports, segmentation forces a Bar chart, with each segment as its own coloured bar, grouped or stacked. In Historical reports, it produces one line per segment value on the time-series chart.

**Include empty values** works on the segment attribute independently of the grouping attribute.

***

### Time Range

Historical reports need a date range. The series buckets by each entity's **creation date**, in UTC, so the report shows how much data was *created* in each interval.

Pick a range from the preset bar:

| Preset                                    | Meaning                                                                                        |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------- |
| **7D**                                    | The last week                                                                                  |
| **1M**                                    | The last month                                                                                 |
| **3M**                                    | The last quarter                                                                               |
| **6M**                                    | The last six months                                                                            |
| **12M**                                   | The last twelve months                                                                         |
| **Week / Month / Quarter / Year to date** | From the start of the current period until now. *Month to date* on July 28 covers July 1 to 28 |
| **Custom**                                | Any from-and-to range you choose. The picker takes a date **and** a time on both ends          |

**Rolling and to-date differ.** *1M* is a rolling window of roughly the last 30 days, ending today. *Month to date* resets at each period start. Pick to-date for tracking progress against the current week, month, quarter or year.

***

### Time Granularity

Granularity divides the range into **Hourly**, **Daily**, **Weekly** or **Monthly** intervals, one data point each.

Flapjax offers the granularities that fit your selected range. Change the range to one that cannot support your current granularity and it auto-corrects to the closest sensible option.

| Range                | Granularities offered                                                                                                                      | Default |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| 7D / Week to date    | Daily                                                                                                                                      | Daily   |
| 1M                   | Daily, Weekly                                                                                                                              | Weekly  |
| Month to date        | Daily, Weekly                                                                                                                              | Daily   |
| 3M / Quarter to date | Weekly, Monthly                                                                                                                            | Weekly  |
| 6M                   | Weekly, Monthly                                                                                                                            | Weekly  |
| 12M                  | Monthly                                                                                                                                    | Monthly |
| Year to date         | Weekly, Monthly                                                                                                                            | Monthly |
| Custom               | Follows the span. Hourly up to 2 days, Daily from 1 day to roughly 3 months, Weekly from 1 week to a year, Monthly from roughly 1 month up | Daily   |

One rule of thumb sits behind those limits. A chart stays readable up to roughly **60 data points**. That is why Hourly over a month, at 720 points, and Daily over a year are both off the table.

***

### What differs on list reports

* A list source asks you which list, and the report then covers that list's current members.
* No **Target** step exists. List reports aggregate the list's own items.
* **Contributing data** works. Click through an aggregated value and the underlying list items open.
* **CSV export of contributing data is not available** for list sources. The interface hides the export action, and the API rejects the request.
