테이블 계산을 만들 수 있는 권한이 있는 경우 바로가기 계산을 사용하면 Looker 함수 및 연산자를 사용하지 않고 Explore의 데이터 테이블에 있는 숫자 필드에 대한 일반적인 계산을 수행할 수 있습니다.
관리자 또는 다른 사용자가 Explore에서 피벗 데이터를 분석하려는 경우가 있을 수 있습니다. 이 페이지에서는 pivot_row() 테이블 계산 함수를 사용하여 사용자가 Explore 데이터를 더 자세히 파악하는 데 도움이 되는 행 합계 및 기타 집계를 만드는 방법을 설명합니다.
pivot_row()의 작동 원리는 어떻게 되나요?
pivot_row() 테이블 계산 함수는 피벗된 행의 모든 값을 목록으로 그룹화합니다.
이 예에서는 제품 수를 주문 생성일별로 그룹화하고 사용자 연령을 기준으로 피벗한 다음 Explore 데이터 테이블을 사용합니다.
pivot_row()를 사용하여 모든 제품 수 행 값을 하나의 열로 그룹화하는 테이블 계산을 작성할 수 있습니다.
pivot_row(${products.count})
그런 다음 테이블 계산은 피벗된 각 행에 있는 제품 수의 모든 값 목록을 표시하는 새 열을 출력합니다.
pivot_row()를 사용하여 행 합계 계산
또한 pivot_row() 함수로 만든 목록에 계산을 수행하여 추가 분석을 할 수 있습니다. 예를 들어 pivot_row()에서 반환된 나열된 값에 sum() 함수를 사용하여 행 합계를 계산할 수 있습니다.
제품 수가 주문 생성일별로 그룹화되고 사용자 연령으로 피벗된 동일한 Explore 데이터 테이블을 사용하면 다음 테이블 계산을 작성하여 제품 수의 행 합계를 출력할 수 있습니다.
sum(pivot_row(${products.count}))
테이블 계산은 pivot_row() 함수로 계산된 제품 수 값 목록을 합산하고 피벗된 각 행의 합계를 표시하는 새 열을 출력합니다.
pivot_row()를 사용하여 다른 합산 계산
pivot_row() 함수를 사용하여 피벗된 행에서 합산할 수 있습니다. 예를 들어 sum() 대신 목록에 있는 값의 mean(), max(), min() 등을 계산할 수도 있습니다. Looker 함수 및 연산자 문서 페이지의 이 섹션에는 사용 가능한 모든 테이블 계산 함수와 연산자가 나와 있습니다.
pivot_row() 함수를 사용하여 피벗 행 전체에서 더 복잡한 계산을 수행할 수도 있습니다(전체 백분율 포함). 전체 대비 비율을 계산하는 방법 권장사항 페이지에서 pivot_row()를 사용하여 행 간 총계 비율을 계산하는 방법을 알아보세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-30(UTC)"],[],[],null,["# Aggregating across rows (row totals) in table calculations\n\n\u003e You can use [shortcut calculations](/looker/docs/table-calculations#quick_calculations) to perform common calculations on numeric fields that are in an Explore's data table without using Looker [functions and operators](/looker/docs/functions-and-operators) when you have the [permissions](/looker/docs/admin-panel-users-roles#create_table_calculations) to create table calculations.\n\n\nThere may be situations where you or other users want to analyze [pivoted data in Explores](/looker/docs/creating-and-editing-explores#pivoting_dimensions). This page discusses how you can use the [`pivot_row()` table calculation function](/looker/docs/functions-and-operators#pivot-related_functions_for_table_calculations_only) to create row totals and other aggregations that can help users gain further insight into Explore data.\n\nHow does `pivot_row()` work?\n----------------------------\n\n\nThe `pivot_row()` table calculation function groups all the values of a pivoted row into a list.\n\n\nThis example uses the following Explore data table with **Products Count** grouped by **Orders Created Date** and pivoted by **Users Age** :\n\n\nYou can use `pivot_row()` to write a table calculation that will group all of the **Products Count** row values into one column: \n\n```\npivot_row(${products.count})\n```\n\n\nThe table calculation then outputs a new column that displays a list of all the values of **Products Count** in each pivoted row:\n\nCalculating the row total using `pivot_row()`\n---------------------------------------------\n\n\nYou can also perform calculations on the lists that you create with the `pivot_row()` function to make further analyses. For example, you can calculate row totals by using the `sum()` function on the listed values that are returned by `pivot_row()`.\n\n\nUsing the same Explore data table with **Products Count** grouped by **Orders Created Date** and pivoted by **Users Age** , you can write the following table calculation to output the row totals for **Products Count**: \n\n```\nsum(pivot_row(${products.count}))\n```\n\n\u003cbr /\u003e\n\n\nThe table calculation sums the list of **Products Count** values that are calculated with the `pivot_row()` function and outputs a new column that displays the total of each pivoted row:\n\nCalculating other aggregations using `pivot_row()`\n--------------------------------------------------\n\n\nYou can use the `pivot_row()` function to aggregate across any pivoted row. For example, rather than a `sum()`, you can also calculate the `mean()` of the values in the list, the `max()`, the `min()`, and so on. This section of the [Looker functions and operators](/looker/docs/functions-and-operators#functions_for_table_calculations_only) documentation page lists all the available table calculation functions and operators.\nYou can also perform more complex calculations across pivot rows with the `pivot_row()` function, including a percent of total. Read about how to use `pivot_row()` to calculate a percent of total across rows in the [How to calculate percent-of-total](/looker/docs/best-practices/how-to-calculate-percent-of-total) Best Practices page.\n\n\u003cbr /\u003e"]]