---
schema_version: "1"
id: 4e1730afded82b1fcdd87acf0254e702074219634468db0b7525be783100762d
title: 创建简单的计算字段
collection: tableau
version: next
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/next/zh-cn/pro/desktop/calculations_calculatedfields_formulas.md
canonical_url: https://help.tableau.com/v0.0/pro/desktop/zh-cn/calculations_calculatedfields_formulas.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 7f5ac90765b2c1c02cf93dc27f4882f0be5e46669bc69a5269081fe6637a2b91
description: Create a simple calculated field, such as Profit Ratio, using a formula from existing fields.
---
[跳转到主要内容](#main-content)

# 创建简单的计算字段

有时，您的数据源不包含分析所需要的字段（或列）。例如，您的数据源可能包含带有“Sales”（销售额）和“Profit”（利润）值的字段，但不包括带有“Profit Ratio”（利润率）值的字段。如果是这种情况，您可以使用“Sales”（销售额）和“Profit”（利润）字段中的数据为“Profit Ratio”（利润率）创建一个计算字段。

本主题说明如何使用示例创建简单的计算字段。

## 步骤 1：创建计算字段

1. 在 Tableau 内的工作表中，选择“分析”\>“创建计算字段”。
2. 在打开的计算编辑器中，为此计算字段指定一个名称。在本示例中，该计算字段称为**“Profit Ratio”**（利润率）。

## 步骤 2：输入公式

1. 在计算编辑器中，输入以下公式：
    
    SUM(\[Profit\])/SUM(\[Sales\])
    
    公式使用函数、字段和运算符的组合。要了解有关在 Tableau 中创建公式的详细信息，请参阅[在 Tableau 中编写计算](https://help.tableau.com/v0.0/pro/desktop/zh-cn/functions_operators.htm)和[Tableau 中的函数](https://help.tableau.com/v0.0/pro/desktop/zh-cn/functions.htm)。
2. 完成后，单击**“确定”**。新的计算字段将添加到“数据”窗格，并在数据类型图标前面带有 = 来指示它是计算字段。

您现在可以在视图中使用计算字段。

## 检查您的工作！观看如何在操作过程中创建一个简单的计算字段：

## 另请参见

[Tableau 中的计算入门指南](https://help.tableau.com/v0.0/pro/desktop/zh-cn/calculations_calculatedfields_create.htm)

[在 Tableau 中编写计算](https://help.tableau.com/v0.0/pro/desktop/zh-cn/functions_operators.htm)

[Tableau 中的函数](https://help.tableau.com/v0.0/pro/desktop/zh-cn/functions.htm)

[在 Tableau 中创建详细级别表达式](https://help.tableau.com/v0.0/pro/desktop/zh-cn/calculations_calculatedfields_lod.htm)

[使用表计算转换值](https://help.tableau.com/v0.0/pro/desktop/zh-cn/calculations_tablecalculations.htm)