Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Fungsi pivot_where dapat digunakan dalam kalkulasi tabel untuk memilih kolom pivot berdasarkan kondisi.
Sintaks
pivot_where(select_expression, expression)
Fungsi pivot_where menampilkan nilai expression untuk kolom pivot yang secara unik
memenuhi select_expression atau null jika kolom tersebut tidak ada atau tidak unik.
Contoh
Pada contoh berikut, kita mencari kolom pivot yang didasarkan pada "Status Pesanan", dan memiliki nilai "tertunda". Jika kita menemukannya, tampilkan "Jumlah Pesanan" di sel tersebut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]