[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-30。"],[],[],null,["# pivot_index function\n\nThe `pivot_index` function can be used in [table calculations](/looker/docs/table-calculations) to extract and manipulate the value of a pivoted column based on its index (in other words, its position).\n\nSyntax\n------\n\n**`pivot_index(expression, pivot_index)`**\n\nThe `pivot_index` function evaluates `expression` in the context of the pivot column at the position `pivot_index` (1 for first pivot, 2 second pivot, etc.) The function returns null for unpivoted results.\n\nExamples\n--------\n\nThe following table shows a query that counts the number of orders made in each season of the year. The query includes a pivoted dimension, **Products Category** , which has the values `Swimwear` and `Coats`. To compute the total number of orders made in each season across all categories, create a **Total Orders Count** table calculation.\n\nThe **Total Orders Count** table calculation adds the value of the first pivot column to the value of the second pivot column. The formula is: \n\n pivot_index(${orders.count}, 1) + pivot_index(${orders.count}, 2)\n\nThings to know\n--------------\n\n`pivot_index` cannot be used in a [custom filter](/looker/docs/filtering-and-limiting#custom-filters)."]]