フィールドのラベルをExploreによって変えたい
やりたいこと
あるフィールドのlabel(フィールド名の表示)を、Exploreによって違う表示にしたい
具体例
user_idというディメンション
Explore①上では「label: "顧客ID"」とする
その他のExploreでは「label: "カスタマーID"」とする
labelが違うだけで、中身は同じ
実施方法
liquidでExplore名を使ったIF文を書くことで実装可能
関連公式ドキュメント
https://cloud.google.com/looker/docs/liquid-variable-reference?hl=ja#liquid_variable_definitions
code: sample.js
dimension: user_id {
label: "{% if _explore._name == 'order_items' %} 顧客ID {% else %} カスタマーID {% endif %}"
primary_key: yes
type: number
sql: ${TABLE}.id ;;
}
https://scrapbox.io/files/675bd92498d36ff597ed3b9c.pnghttps://scrapbox.io/files/675bd90c39e4105ba61e9245.png
関連
フィールドのlabelをユーザーによって出し分ける