---
schema_version: "1"
id: aaece05abd91bff1fa5a69d8f7e3ea116238015903dac9b8a7634fc8d6d9c9c9
title: 瞭解 Tableau 中的計算
collection: tableau
version: next
locale: zh-tw
portal_url: https://docs.salesforce.com/tableau/next/zh-tw/public/desktop/calculations_calculatedfields_understand.md
canonical_url: https://help.tableau.com/v0.0/public/desktop/zh-tw/calculations_calculatedfields_understand.htm
source_site: help.tableau.com
content_type: documentation
content_hash: fd1524bcefe9f46386719774e9c34ff14bee3cb8aca74acf84acbb9e0434bd55
description: Understand why and when to use calculations to create new data in Tableau.
---
[跳至主要內容](#main-content)

# 瞭解 Tableau 中的計算

本系列介紹了關於瞭解 Tableau 中的計算的基礎知識。在本主題中，您將瞭解為什麼以及何時使用計算。

## 為什麼使用計算

透過計算，您可以根據資料來源中已存在的資料建立新資料，並對資料執行計算。這樣，您可以執行複雜的分析，並且可以動態地自行將欄位新增到您的資料來源中。

## 何時使用計算

在 Tableau 中學習計算的第一個障礙是認識到您何時實際需要使用它。由於很多原因，您可以使用計算。一些範例可能包括：

- 將資料分段
- 轉換欄位的資料類型，例如將字串轉換為日期。
- 彙總資料
- 篩選結果
- 計算比率

一些常見的情況可能包括：

- 您的資料來源中缺少分析所需的資料。
    
    例如，如果資料來源中有 \[Sales\] （銷售額）和 \[Profit\] （利潤）欄位，但您要計算成本，則可以使用類似於以下內容的公式_建立_ \[Cost\] （成本）欄位。
    
    `[Sales] - [Profit]`
    
    ![使用公式建立成本欄位。](/tableau/next/zh-tw/public/desktop/zh-tw/Img/calcs_understand_when2.gif)
- 您想要在視覺效果中轉換值。
    
    例如，您可能要計算一年與另一年之間的利潤差異。您可以使用快速表計算在視覺效果中顯示利潤差異。
    
    ![建立快速資料表計算。](/tableau/next/zh-tw/public/desktop/zh-tw/Img/calcs_understand_when3.gif)
- 您想要快速對資料分類。
    
    例如，您可能想要快速將視覺效果中的資料著色為有利可圖或無利可圖的資料。您可以使用類似於以下的計算來建立計算欄位，然後將其新增到 \[標記\] 卡上的 \[色彩\] 。
    
    `IF SUM([Profit]) > 0   THEN "Profitable"   ELSE "Nonprofitable"   END`
    
    ![在 Tableau 中建立計算欄位。](/tableau/next/zh-tw/public/desktop/zh-tw/Img/calcs_understand_when1.gif)

  

## 此區段的其他文章