Tableau의 계산 유형

이 문서에서는 Tableau에서 사용할 수 있는 계산 유형에 대해 설명합니다. 각 계산과 계산 방법의 차이점을 배우게 됩니다.

Tableau에서 계산된 필드를 만들 때는 세 가지 주요 유형의 계산을 사용할 수 있습니다.

기본 식

기본 식을 사용하면 데이터 원본 세부 수준(행 수준 계산) 또는 비주얼리제이션 세부 수준(집계 계산)에서 값 또는 멤버를 변환할 수 있습니다.

예를 들어 두 판타지 작가와 관련 작품에 대한 데이터가 포함된 다음과 같은 샘플 테이블을 살펴보십시오. 작가의 성만 포함하는 열과 각 시리즈에 몇 권의 책이 있는지 표시하는 열을 만들고 싶다고 가정합니다.

Book IDBook NameSeriesYear ReleasedAuthor
1The Lion, the Witch and the WardrobeThe Chronicles of Narnia1950C.S. Lewis
2Prince Caspian: The Return to NarniaThe Chronicles of Narnia1951C.S. Lewis
3The Voyage of the Dawn TreaderThe Chronicles of Narnia1952C.S. Lewis
4The Silver ChairThe Chronicles of Narnia1953C.S. Lewis
5The Horse and His BoyThe Chronicles of Narnia1954C.S. Lewis
6The Magician's NephewThe Chronicles of Narnia1955C.S. Lewis
7The Last BattleThe Chronicles of Narnia1956C.S. Lewis
8Daughter of the ForestSevenwaters1999Juliet Marillier
9Son of the ShadowsSevenwaters2000Juliet Marillier
10Child of the ProphecySevenwaters2001Juliet Marillier
11Heir of SevenwatersSevenwaters2008Juliet Marillier
12Seer of SevenwatersSevenwaters2010Juliet Marillier
13Flame of SevenwatersSevenwaters2012Juliet Marillier

행 수준 계산

데이터 원본의 모든 행에서 작가의 성을 표시하는 열을 만들려면 공백을 기준으로 분리하는 다음과 같은 행 수준 계산을 사용하면 됩니다.

SPLIT([Author], '', 2 )

결과는 아래에서 볼 수 있습니다. 제목이 Author Last Name인 새 열은 맨 오른쪽에 표시됩니다. 색상은 계산이 수행된 세부 수준을 나타냅니다. 이 경우 계산이 데이터 원본의 행 수준에서 수행되므로 각 행에 개별적으로 색상이 지정됩니다.

Book IDBook NameSeriesYear ReleasedAuthorAuthor Last Name
1The Lion, the Witch and the WardrobeThe Chronicles of Narnia1950C.S. LewisLewis
2Prince Caspian: The Return to NarniaThe Chronicles of Narnia1951C.S. LewisLewis
3The Voyage of the Dawn TreaderThe Chronicles of Narnia1952C.S. LewisLewis
4The Silver ChairThe Chronicles of Narnia1953C.S. LewisLewis
5The Horse and His BoyThe Chronicles of Narnia1954C.S. LewisLewis
6The Magician's NephewThe Chronicles of Narnia1955C.S. LewisLewis
7The Last BattleThe Chronicles of Narnia1956C.S. LewisLewis
8Daughter of the ForestSevenwaters1999Juliet MarillierMarillier
9Son of the ShadowsSevenwaters2000Juliet MarillierMarillier
10Child of the ProphecySevenwaters2001Juliet MarillierMarillier
11Heir of SevenwatersSevenwaters2008Juliet MarillierMarillier
12Seer of SevenwatersSevenwaters2010Juliet MarillierMarillier
13Flame of SevenwatersSevenwaters2012Juliet MarillierMarillier

집계 계산

각 시리즈에 포함된 책 수를 표시하는 열을 만들려면 다음과 같은 집계 계산을 사용하면 됩니다.

COUNT([Series])

결과는 아래에서 볼 수 있습니다. 제목이 Number of Books in Series - at Series level of detail인 새로운 열은 뷰의 Series 세부 수준에서 계산이 수행되는 방식을 보여 줍니다. 색상은 계산이 수행되는 세부 수준을 나타냅니다.

SeriesNumber of Books in Series - at Series level of detail
The Chronicles of Narnia7
The Chronicles of Narnia
The Chronicles of Narnia
The Chronicles of Narnia
The Chronicles of Narnia
The Chronicles of Narnia
The Chronicles of Narnia
Sevenwaters6
Sevenwaters
Sevenwaters
Sevenwaters
Sevenwaters
Sevenwaters

Tableau에서 데이터는 다음과 같이 표시됩니다.

하지만 더 세분화된 필드인 Book Id에 끌어 놓으면 집계 계산이 비주얼리제이션 세부 수준에서 수행되기 때문에 새 세부 수준을 기준으로 계산이 업데이트됩니다.

세부 수준(LOD) 식

기본 식과 마찬가지로 LOD 식을 사용하여 데이터 원본 수준 및 비주얼리제이션 수준에서 값을 계산할 수 있습니다. 그러나 LOD 식을 사용하면 계산할 세부 수준을 보다 세부적으로 제어할 수 있습니다. 더 세분화된 수준(INCLUDE), 덜 세분화된 수준(EXCLUDE) 또는 완전히 독립적인 수준(FIXED)에서 LOD 계산을 수행할 수 있습니다.

자세한 내용은 Tableau에서 세부 수준 식 만들기(링크가 새 창에서 열림)을 참조하십시오.

예를 들어 와 동일한 샘플 테이블을 살펴보겠습니다. 책 시리즈가 출시된 시기를 계산하고 싶다면 다음 LOD 식을 사용할 수 있습니다.

{ FIXED [Series]:(MIN([Year Released]))}

결과는 아래에서 볼 수 있습니다. 제목이 Series Launched인 새 열에 각 시리즈의 연도 최소값이 표시됩니다. 색상은 계산이 적용되는 세부 수준을 나타냅니다.

Book IDBook NameSeriesYear ReleasedAuthorSeries Launched
1The Lion, the Witch and the WardrobeThe Chronicles of Narnia1950C.S. Lewis1950
2Prince Caspian: The Return to NarniaThe Chronicles of Narnia1951C.S. Lewis1950
3The Voyage of the Dawn TreaderThe Chronicles of Narnia1952C.S. Lewis1950
4The Silver ChairThe Chronicles of Narnia1953C.S. Lewis1950
5The Horse and His BoyThe Chronicles of Narnia1954C.S. Lewis1950
6The Magician's NephewThe Chronicles of Narnia1955C.S. Lewis1950
7The Last BattleThe Chronicles of Narnia1956C.S. Lewis1950
8Daughter of the ForestSevenwaters1999Juliet Marillier1999
9Son of the ShadowsSevenwaters2000Juliet Marillier1999
10Child of the ProphecySevenwaters2001Juliet Marillier1999
11Heir of SevenwatersSevenwaters2008Juliet Marillier1999
12Seer of SevenwatersSevenwaters2010Juliet Marillier1999
13Flame of SevenwatersSevenwaters2012Juliet Marillier1999

Tableau에서 계산은 FIXED 함수를 사용하기 때문에 Series 세부 수준에 유지됩니다.

The Chronicles of Narnia에 날짜 1950이 표시되고 Sevenwaters에 1999가 표시된 비주얼리제이션

뷰에 또 다른 필드를 추가(더 많은 세부 수준을 추가)하는 경우 집계 계산과 달리 계산의 값이 영향을 받지 않습니다.

Narnia의 모든 책에 날짜 1950이 반복되고 Sevenwaters의 모든 책에 1999가 반복되는 비주얼리제이션

테이블 계산

테이블 계산을 사용하면 비주얼리제이션 전용 세부 수준에서 값을 변환할 수 있습니다.

자세한 내용은 테이블 계산으로 값 변환(링크가 새 창에서 열림)을 참조하십시오.

예를 들어 와 동일한 샘플 테이블을 살펴보겠습니다. 작가가 마지막 책을 출판한 이후 경과된 연도 수를 계산하려는 경우 다음 테이블 계산을 사용할 수 있습니다.

ATTR([Year Released]) - LOOKUP(ATTR([Year Released]), -1)

결과는 아래와 같습니다. 제목이 Years Since Previous Book인 새로운 열은 해당 행의 책이 출판된 연도와 이전 행의 책이 출판된 연도 사이의 차이(열의 맨 오른쪽)를 보여 주며 테이블 계산이 수행되는 방식(열의 맨 왼쪽)을 나타냅니다.

색상을 통해 테이블 계산이 수행되는 방식을 쉽게 알 수 있습니다. 이 경우 테이블 계산은 각 패널에서 아래쪽으로 계산됩니다.

참고: 테이블 계산과 테이블에서 계산이 수행되는 방식에 따라 결과가 달라질 수 있습니다. 자세한 내용은 테이블 계산으로 값 변환(링크가 새 창에서 열림)을 참조하십시오.

Book IDBook NameSeriesYear ReleasedAuthor Years Since Previous Book
1The Lion, the Witch and the WardrobeThe Chronicles of Narnia1950C.S. LewisNULL 
2Prince Caspian: The Return to NarniaThe Chronicles of Narnia1951C.S. Lewis1951-19501
3The Voyage of the Dawn TreaderThe Chronicles of Narnia1952C.S. Lewis1952-19511
4The Silver ChairThe Chronicles of Narnia1953C.S. Lewis1953-19521
5The Horse and His BoyThe Chronicles of Narnia1954C.S. Lewis1954-19531
6The Magician's NephewThe Chronicles of Narnia1955C.S. Lewis1955-19541
7The Last BattleThe Chronicles of Narnia1956C.S. Lewis1956-19551
8Daughter of the ForestSevenwaters1999Juliet MarillierNULL 
9Son of the ShadowsSevenwaters2000Juliet Marillier2000-19991
10Child of the ProphecySevenwaters2001Juliet Marillier2001-20001
11Heir of SevenwatersSevenwaters2008Juliet Marillier2008-20017
12Seer of SevenwatersSevenwaters2010Juliet Marillier2010-20082
13Flame of SevenwatersSevenwaters2012Juliet Marillier2012-20102

Tableau에서 데이터는 다음과 같이 표시됩니다.

각 책의 이전 책 연도가 올바르게 표시된 비주얼리제이션

하지만 뷰에서 차원을 제거하는 등, 레이아웃에 영향을 주는 방식으로 비주얼리제이션을 변경하면 계산 값이 변경됩니다.

예를 들어 아래 이미지에서 Author가 비주얼리제이션에서 제거됩니다. 테이블 계산은 패널 기준으로 계산되기 때문에 Author를 제거하면 비주얼리제이션의 레이아웃 및 세부 수준이 변경됩니다(이제 패널이 두 개가 아니라 하나만 있음). 따라서 테이블 계산이 1956과 1999 사이의 기간을 계산합니다.

Sevenwaters 책의 이전 책 연도가 잘못 표시된 비주얼리제이션


계속해서 올바른 계산 유형 선택 진행올바른 계산 유형 선택

참고 항목

Tableau의 계산 이해(링크가 새 창에서 열림)

계산을 만드는 방법을 학습하기 위한 팁(링크가 새 창에서 열림)


피드백을 제공해 주셔서 감사합니다!귀하의 피드백이 제출되었습니다. 감사합니다!