label_from_parameter

LookML
Version

On this Page
Docs Menu

Go to Field Parameter List

Definition

The label_from_parameter parameter allows you to change how a field name appears in a table 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 what database column they want 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_values: - value: 'sale_price' label: 'Total Sale Price' - value: 'cost' label: 'Total Cost' - value: 'profit' label: 'Total 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:

Still have questions?
Go to Discourse - or - Email Support
Top