# Custom Analytics

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-d61c3469b2516c1c74f1c382fa03a7c10db659b6%2FCustom%20Analytics.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %} <mark style="color:blue;">**`Custom Analytics`**</mark> is currently in **beta**.\
It will become a paid feature after the official release.
{% endhint %}

***

## Key Highlights

* Use SQL to query your BoxHero data.
* Combine conditions (e.g. item, attribute, price, date range, partner) to define the data you want to return as a custom report.
* Save queries you use often and open them again at any time.
* Export results to Excel for additional analysis or reporting.

## When to Use Custom Analytics

The standard <mark style="color:blue;">**`Inventory Reports`**</mark> feature gives you a quick view of key metrics like average stock quantity and inventory turnover for a selected period. Because those reports use predefined formulas and fields, they may not cover every type of analysis your team needs.

<mark style="color:blue;">**`Custom Analytics`**</mark> gives you more control over how you explore your data. It’s especially useful when:

* You can’t find the data you need in the standard [Inventory Reports](https://www.boxhero.io/docs/other-features/analytics)
* You want to filter or group data by item, supplier, customer, team member, or other detailed conditions
* You need time-based analysis such as monthly, quarterly, or year-over-year
* You want to save reports you rely on and use them again
* You need flexible data to support reporting or decision-making

***

## How to Use Custom Analytics

### 1. Getting Started

Go to <mark style="color:blue;">**`Reports`**</mark> > <mark style="color:blue;">**`Custom Analytics`**</mark>. This opens a new workspace where you can create and manage your SQL queries. Then, select <mark style="color:blue;">**`+ New`**</mark> to create a new query.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-6960754566997f8dfd56a04778905774d0b8c7d2%2Fcustom-analytics-welcome.png?alt=media" alt=""><figcaption></figcaption></figure>

### 2. Write a Query

Queries use [DuckDB SQL](https://duckdb.org/docs/stable/sql/introduction). You can download the <mark style="color:blue;">**`AI Prompt`**</mark> file to see all available tables and columns.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-565c3ed88b69c6de48e7fade26e3212a3f034b19%2Fcustom-analytics-new-query.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
If you’re using **AI tools** such as ChatGPT or Gemini, attaching the "*AI Prompt"* file helps generate accurate SQL.
{% endhint %}

Select <mark style="color:blue;">**`Execute`**</mark> to test your query. Since results depend on the conditions you write, review the output to confirm that it matches what you expect.

After your query runs successfully, you can export the results with <mark style="color:blue;">**`Export to Excel`**</mark>.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-cfc1d5c123f1352a5b6093f60ecedf6bc75136ae%2Fcustom-analytics-execute-sql-query.png?alt=media" alt=""><figcaption></figcaption></figure>

### 3. Save a Query

If you plan to reuse a query, select <mark style="color:blue;">**`Save`**</mark> in the top-right corner.

Saved queries appear in the left sidebar, where you can open and run them at any time.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-fbbe3777b87c3433ebdf88f73707514a4661997c%2Fcustom-analytics-monthly-revenue-spend.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Your data syncs automatically **once a day**.\
To sync immediately, click the sync icon (🔄) at the bottom of the sidebar.
{% endhint %}

***

## Query Variables

If you include `{{variable_name}}` in your query, an input field is automatically generated when the query runs. The value entered in that field is applied to the variable in your SQL query.

When you save a query, your team members can enter their own values in the variable field and run the report whenever they need it.

#### Example

1. To search for items that contain a specific keyword, enter the following query:

```sql
select sku, name 
from items 
where name ilike '%' || {{item_name}} || '%';
```

2. When you run the query, an input field named **item\_name** appears.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-0e37f6dcdc52cfcb1415c0e175422f65a0f0f922%2Fcustom-analytics-query-variables.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Enter a keyword such as *`sweater`* and the results will show all items with *“sweater”* in their name.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-6b0e5a3a5d226e5f678354e11ede42ce36f514eb%2Fcustom-analytics-query-variables-keyword.png?alt=media" alt=""><figcaption></figcaption></figure>

4. Save the query if you plan to use it again. You can select and load saved queries anytime from the left-hand menu.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-b428ef1d1d046a131901affe11e06926f0910343%2Fcustom-analytics-saved-query-variables.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## Use Cases

Custom Analytics includes built-in templates you can run right away. Review a template to understand how it works, then adjust it or create a new query based on your needs.

#### Templates

* Weekly Stock In/Out Report
* Monthly Purchase and Sales Trend
* Last Outbound Date by Item

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-5bfafcad6d5c7a69353ac530532be7fd32f542b5%2Fcustom-analytics-saved-template-example.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## Frequently Asked Questions (FAQ)

### Can I combine data from multiple teams?

No. Data is separated by team, and you can only analyze data from the team you are currently logged into.

### Can I restrict members from using Custom Analytics?

Admins and members can create and view queries. Members with custom permissions *do not* have access to this feature.

If you need to to restrict access for a member, assign them a [custom permission](https://www.boxhero.io/docs/settings/members#custom-roles-and-permissions) with **all permissions selected**. Custom Analytics is *not* included in custom permission options, so even with all permissions selected, the member will not have access.

<figure><img src="https://687823928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRf1QqJGoevCQqGbfI80%2Fuploads%2Fgit-blob-ed545f8a01d471bb0d774157ef6209e756574a4c%2Fcustom-analytics-member-permissions.png?alt=media" alt=""><figcaption></figcaption></figure>
