home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
Looker documentation will be moving to cloud.google.com in mid-2022!
All the information you rely on will be migrated and all docs.looker.com URLs will be redirected to the appropriate page.
label_from_parameter

Usage

view: view_name {
  dimension: field_name {
    label_from_parameter: parameter_name
  }
}
Hierarchy
label_from_parameter
Possible Field Types
Dimension, Measure

Accepts
A parameter name

Definition

The label_from_parameter parameter lets you change how a field name appears in a visualization, based on the value of a parameter.

In the following example we create a parameter called item_to_add_up that lets a user choose the database column to sum. A corresponding measure called dynamic_sum performs the calculation, and it takes on the name of the parameter value because we’ve used label_from_parameter: item_to_add_up

parameter: item_to_add_up { type: unquoted allowed_value: { label: "Total Sale Price" value: "sale_price" } allowed_value: { label: "Total Cost" value: "cost" } allowed_value: { label: "Total Profit" value: "profit" } }   measure: dynamic_sum { type: sum sql: ${TABLE}.{% parameter item_to_add_up %} ;; label_from_parameter: item_to_add_up value_format_name: "usd" }

In Looker the appearance would be:

Top