> For the complete documentation index, see [llms.txt](https://adatrack.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://adatrack.gitbook.io/docs/documentation/features/statistics.md).

# Statistics & Analytics

The **Statistics Module V2** is a powerful data exploration workspace that allows you to analyze historical telemetry, identify trends, and create custom visualizations for your IoT fleet.

### Key Capabilities

* **Visual Query Builder:** Construct complex, SQL-like queries without writing a single line of code.
* **Interactive Charts:** Visualize your data with interactive line, bar, area, and scatter plots.
* **Dynamic Time Ranges:** Use relative presets (e.g., "Last 24 Hours", "Last 7 Days") or custom ranges across all analytics views.
* **Saved Configurations:** Save your frequent queries and chart designs to reuse them later or embed them in dashboards.
* **Multi-Dimensional Filtering:** Analyze data across specific devices, entire device profiles, or custom groups.
* **Schema Discovery:** The interface automatically identifies available telemetry fields (e.g., `temperature`, `voltage`) based on your recent data.

### 1. Overview Dashboard (Saved Charts Grid)

The **Overview** tab is your personalized intelligence hub. Instead of static charts, it features a dynamic grid of your **Saved Chart Configurations**.

1. **Saved Charts Grid:** Every chart you create in the "Telemetry Trends" explorer can be pinned here.
2. **Visual Consistency:** Each tile in the grid represents a persistent query, ensuring you see the exact same logic and filters every time you load the page.
3. **One-Click Exploration:** Click any chart tile to jump directly into the "Telemetry Trends" explorer with all filters and settings pre-loaded for deeper analysis.

### 2. Telemetry Trends Explorer

The **Telemetry Trends** explorer is the easiest way to visualize your sensor data over time.

1. **Select Scope:** Choose whether to analyze a specific list of devices or an entire **Device Profile**.
2. **Pick a Field:** Select the telemetry metric you want to visualize (e.g., `payload.temp`).
3. **Choose Visualization:** Select your preferred chart type (Line, Bar, Area, Scatter).
4. **Set Dynamic Time Range:** Filter the data by the last hour, 24 hours, 7 days, or a custom range.
5. **Aggregations:** Use functions like `Average`, `Sum`, `Min`, `Max`, and `Count` to see fleet-wide patterns.

### 3. Advanced Query Builder

For deep data exploration, the **Advanced Query Builder** allows you to construct sophisticated filters and projections.

* **Projections:** Select exactly which columns you want to return (e.g., `timestamp`, `device_id`, `payload.voltage`).
* **Visual Filters:** Build complex `WHERE` clauses using `AND`/`OR` logic groups.
* **Operators:** Use advanced operators like `CONTAINS`, `EXISTS`, `>`, `<`, and `IN`.
* **Data Grid:** View the raw results of your query in a high-performance, sortable, and paginated data grid.

### 4. Saving & Reusing

Consistency is key for operational monitoring. Once you've perfected a query or chart:

1. **Save Query:** Save the underlying logic as a "Saved Query" (e.g., "High Temperature Events").
2. **Save Chart:** Save the visual configuration as a "Chart Configuration" (e.g., "Fleet Battery Status").
3. **Dashboard Integration:** These saved charts can then be added as widgets to your [Interactive Dashboards](/docs/documentation/features/dashboards.md).

### Technical Foundation

* **TimescaleDB Hypertables:** All analytical queries are powered by TimescaleDB, ensuring that even queries scanning millions of rows remain fast.
* **JSONB Indexing:** AdaTrack leverages PostgreSQL's JSONB capabilities to perform efficient filtering on decoded telemetry payloads.
* **Asynchronous Execution:** Complex queries are executed asynchronously to ensure the UI remains responsive while the database processes large datasets.

### Tips for Better Analytics

* **Use Aggregations:** When analyzing large fleets, use aggregated views (Average, Min, Max) to identify system-wide trends rather than focusing on individual device noise.
* **Monitor Query Complexity:** While the query builder is powerful, very complex filters over long time ranges can be slow. Try to narrow your time window or scope when performing deep analysis.
* **Export your Data:** Use the "Export to CSV" feature in the Query Builder to take your data into external tools for further processing.
