> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/platform-features/multi-program-reports/data-lab-custom-reports/create-custom-measures-in-data-lab.md).

# 在 Data Lab 中创建自定义指标

Data Lab 的内置指标覆盖了大多数报告需求，但有时你需要一个针对你的项目的计算，例如自定义转化率、加权总计，或两个现有指标之间的比率。自定义指标允许你使用现有指标和维度定义自己的公式，因此结果会像任何标准指标一样显示在你的可视化中。

{% hint style="warning" %}
**重要：** 我们 *强烈* 建议你参考 [Data Lab 简介](/brand/zh/what-would-you-like-to-learn-about/platform-features/multi-program-reports/data-lab-custom-reports/data-lab-introduction.md) 在开始阅读本文之前。
{% endhint %}

1. 从左侧导航菜单中选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-230534471fef5f40808e921e41ee44e4a06ded03%2Fe6cb9548999afdc1ed3ce4942e4cb5b45b5cecbd323267aac2a7cd1915fccc09.svg?alt=media) **\[Engage] → 报告** → [**数据实验室**](https://app.impact.com/secure/advertiser/engage/reportBuilder.ihtml).
2. 选择一个 **可视化** 开始使用。
3. 从 *维度和度量* 在右侧工具栏中的部分，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-6282f271b7521383385339243690b303086736d9%2F3b5a585dd2895bdf1c30d1236c72ba590dddd18717863b27074c8d313d05ae20.svg?alt=media) **\[创建自定义度量]**.

   <div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FaJ9k8ckxQGr9Bokgj8Mb%2FUntitled%20design%20(12).png?alt=media&amp;token=68dfc0f3-adb5-4c88-8447-6ceafc61b73d" alt="" width="355"><figcaption></figcaption></figure></div>
4. 在 *公式* 字段，输入自定义度量的计算公式。如果您只需要单个维度值的结果（例如一个事件类型），您可以使用 `筛选` 在公式中。&#x20;

   * 请参阅 [将度量筛选到特定值](#filter-a-measure-to-a-specific-value) 以下内容以了解更多信息。

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>示例：</strong> 该 <em>转化率</em> 度量使用 <code>操作 / 点击次数</code>. impact.com 将通过在下方显示验证消息来说明公式是否有效，下方的 <em>公式</em> 框。</p></div>
5. 为您的自定义指标命名（例如， *转化率）*.
6. 从 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-c2cb550b55c51ea1eeff0acbd6f437a03b621a2c%2F60d033ae8a04c14498d5229c3c0160ac05feea7f605dbd770741793c900469f0.svg?alt=media) **\[下拉菜单]**，选择您的指标的 **格式**。您可以在以下之间进行选择 *数字*, *字符串*, *百分比*，或 *货币*.
7. 选择 **保存** 以保存您的自定义度量。

   <div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FeRSxwBeihOE4jt2Um20f%2FScreenshot%202026-04-27%20at%2017.31.58.png?alt=media&amp;token=805ccf5a-b8b8-499d-86e7-efc04994dc80" alt="" width="563"><figcaption></figcaption></figure></div>

## 将度量筛选到特定值

自定义度量通常会跨某个维度的每个值进行计算。有时您只想要某一个值的结果，例如单个事件类型的转化率，而不必单独构建可视化或依赖透视表。该 `筛选` 函数可让您直接在公式中将度量限定到恰好一个维度值。

1. 在右侧工具栏的“维度和度量”部分中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-6282f271b7521383385339243690b303086736d9%2F3b5a585dd2895bdf1c30d1236c72ba590dddd18717863b27074c8d313d05ae20.svg?alt=media) **\[创建自定义度量]**.
2. 输入 `筛选` 在 *公式* 字段中。随着你输入，Data Lab 会建议度量、维度和值。一个 *有效* 或 *无效* 标签将会出现，以说明公式是否有效。
3. 输入一个 **名称** 作为该度量的名称（例如， *销售转化率*).
4. &#x20;从 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-c2cb550b55c51ea1eeff0acbd6f437a03b621a2c%2F60d033ae8a04c14498d5229c3c0160ac05feea7f605dbd770741793c900469f0.svg?alt=media) **\[下拉菜单]**，选择您的指标的 **格式**.&#x20;
5. 选择 **保存**.

<div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FAPIC59sIvphC3MM0Mmdz%2FScreenshot%202026-08-26%20at%2014.56.52.png?alt=media&amp;token=573db799-5c8e-4641-abe9-eef93c3bb01a" alt="" width="485"><figcaption></figcaption></figure></div>

### Filter 函数格式

以以下格式使用 Filter 函数 *Filter(Measure, Dimension=Value)。*&#x20;

<table><thead><tr><th width="167.26953125">元素</th><th>输入内容</th></tr></thead><tbody><tr><td>度量</td><td>一个现有度量，例如 <em>操作。</em></td></tr><tr><td>维度</td><td>要限制的维度，例如 <em>事件类型</em>.</td></tr><tr><td>=</td><td>唯一支持的比较 <code>筛选</code> 支持。你不能使用 <code>!=</code>, <code>></code>, <code>&#x3C;</code>, <code>IN</code>, <code>AND</code>，或 <code>OR</code>.</td></tr><tr><td>值</td><td>该维度中的一个值，例如某个事件类型的名称。</td></tr></tbody></table>

### 组合筛选器

* **将筛选器与其他度量组合：** 使用 `+`, `-`, `*`, `/` 以及括号。你不能将一个筛选器嵌套在另一个筛选器中，例如 `Filter(Filter(...))`.
* **统计多个值：** 为每个值分别添加一个独立的 Filter 公式。\
  例如： `Filter(Actions, Event Type=Sale) + Filter(Actions, Event Type=Lead)`
* **没有匹配的行：** 该度量显示 **0**，或 **0%** 如果格式设置为 *百分比*.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/platform-features/multi-program-reports/data-lab-custom-reports/create-custom-measures-in-data-lab.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
