Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A função pivot_where pode ser usada em um cálculo de tabela para selecionar uma coluna pivot por uma condição.
Sintaxe
pivot_where(select_expression, expression)
A função pivot_where retorna o valor de expression para a coluna de resumo que atende exclusivamente
a select_expression ou null, se essa coluna não existir ou não for exclusiva.
Examples
No exemplo a seguir, procuramos a coluna de pivote com base no "Status do pedido" e um valor de "pendente". Se ele for encontrado, retorne a "Contagem de pedidos" nessa célula:
Se houver exatamente uma coluna de pivot em que select_expression for verdadeiro, o expression será retornado. Caso contrário, o expression vai retornar NULL.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-07-30 UTC."],[],[],null,["# pivot_where Function\n\nThe `pivot_where` function can be used in a [table calculation](/looker/docs/table-calculations) to select a pivot column by a condition.\n\nSyntax\n------\n\n**`pivot_where(select_expression, expression)`**\n\nThe `pivot_where` function returns the value of `expression` for the pivot column which uniquely\nsatisfies `select_expression` or `null` if such a column does not exist or is not unique.\n\nExamples\n--------\n\nIn the following example we look for the pivot column that is based on \"Order Status\", and has a value of \"pending\". If we find it, return the \"Order Count\" in that cell: \n\n pivot_where(${orders.status} = \"pending\", ${orders.count})\n\nThings to know\n--------------\n\n1. If there is *exactly* one pivot column where `select_expression` is true, the `expression` is returned. Otherwise the `expression` returns NULL.\n\n2. `pivot_where` cannot be used in a [custom filter](/looker/docs/filtering-and-limiting#custom-filters)."]]