Tableau-functions

提供:Dev Guides
移動先:案内検索

Tableau-関数

データ分析には多くの計算が含まれます。 Tableauでは、計算エディターを使用して、分析対象のフィールドに計算を適用します。 Tableauには、複雑な計算の式を作成するのに役立つ多くの組み込み関数があります。

次に、さまざまなカテゴリの機能の説明を示します。

  • 数字関数
  • 文字列関数
  • 日付関数
  • 論理関数
  • 集約関数

数字関数

これらは数値計算に使用される関数です。 入力として数値のみを受け取ります。 重要な数値関数の例を次に示します。

Function Description Example
CEILING (number) Rounds a number to the nearest integer of equal or greater value. CEILING(2.145) = 3
POWER (number, power) Raises the number to the specified power. POWER(5,3) = 125
ROUND (number, [decimals]) Rounds the numbers to a specified number of digits. ROUND(3.14152,2) = 3.14

文字列関数

文字列関数は、文字列操作に使用されます。 以下にいくつかの重要な文字列関数と例を示します

Function Description Example
LEN (string) Returns the length of the string. LEN("Tableau") = 7
LTRIM (string) Returns the string with any leading spaces removed. LTRIM(" Tableau ") = "Tableau"
REPLACE (string, substring, replacement) Searches the string for substring and replaces it with a replacement. If the substring is not found, the string is not changed. REPLACE("GreenBlueGreen", "Blue", "Red") = "GreenRedGreen"
UPPER (string) Returns string, with all characters uppercase. UPPER("Tableau") = "TABLEAU"

日付関数

Tableauには、日付に関する計算を実行するためのさまざまな日付関数があります。 すべての日付関数は、 date_part を使用します。これは、月、日、年などの日付の一部を示す文字列です。 次の表に、重要な日付関数の例をいくつか示します。

Function Description Example
*DATEADD (date_part, increment, date) * Returns an increment added to the date. The type of increment is specified in* date_part*. DATEADD ('month', 3, 2004-04-15) = 2004-0715 12:00:00 AM
*DATENAME (date_part, date, [start_of_week]) * Returns* date_part of date as a string. The start_of_week* parameter is optional. DATENAME('month', 200404-15) = "April"
DAY (date) Returns the day of the given date as an integer. DAY(2004-04-12) = 12
NOW( ) Returns the current date and time. NOW( ) = 2004-04-15 1:08:21 PM

論理関数

これらの関数は、単一の値または式の結果を評価し、ブール出力を生成します。

関数

説明

  • IFNULL(expression1、expression2)*

IFNULL関数は、結果がヌルでない場合は最初の式を返し、ヌルの場合は2番目の式を返します。

IFNULL([Sales]、0)= [Sales]

  • ISDATE(文字列)*

ISDATE関数は、文字列引数を日付に変換できる場合はTRUEを返し、変換できない場合はFALSEを返します。

ISDATE( "11/05/98")= TRUE

ISDATE( "14/05/98")= FALSE

  • MIN(式)*

MIN関数は、すべてのレコードにわたる式の最小値、または各レコードの2つの式の最小値を返します。

集約関数

Function Description Example
AVG(expression) Returns the average of all the values in the expression. AVG can be used with numeric fields only. Null values are ignored.
COUNT (expression) Returns the number of items in a group. Null values are not counted.
MEDIAN (expression) Returns the median of an expression across all records. Median can only be used with numeric fields. Null values are ignored.
STDEV (expression) Returns the statistical standard deviation of all values in the given expression based on a sample of the population.