Table using user filter

  • 24 May 2019
  • 1 reply

Hi guys

I would like to know if it possible to create a view that will change “sql_table_name” using Filter with information


filter: filter_partition{

label: “PartitionDate”

description: “PartitionDate”

type: string


If my user choices filter “a” sql_table_name will use table_a

If my user choices filter b sql_table_name will use table_b

If my user choices filter b«c sql_table_name will use table_c

1 reply

Hi @alberto_junior and welcome!

You can do this using a view parameter and then using Liquid in the sql_table_name: for the view. I set up an example and it looks like it’ll work:

explore: test_dynamic_table_param {}

view: test_dynamic_table_param {

parameter: dynamic_table {

type: unquoted

default_value: "the_default_table"

allowed_value: {

label: "First table"

value: "the_first_choice_of_table"


allowed_value: {

label: "Second table"

value: "the_second_choice_of_table"



sql_table_name: schema_name.{{ dynamic_table._parameter_value }} ;;

dimension: some_dim {



If the parameter is used in the Explore as a filter (slightly confusing naming!) the user can choose one of the allowed values for the parameter. If they don’t filter with the parameter, the default table the_default_table will be used. In the view’s sql_table_name I’m using the Liquid {{ }} syntax to reference the value of the parameter.

Note that the parameter has type: unquoted - otherwise the string is quoted and we’d end up with schema_name.'the_second_choice_of_table' which is probably not what you want!

See the docs on parameters and Liquid variables for reference.