Question

Dynamic value in parameter

  • 19 July 2021
  • 1 reply
  • 15 views

Hello All,

I want to create a dynamic parameter where I can choose the next three months from current month.

Can anyone help me to get the solution of this?


1 reply

Userlevel 6
Badge +1

As you can see here: https://docs.looker.com/reference/field-params/parameter the parameters are, by design, quite static, hence the need to specify all allowed values. But you could still do it by allowing people to enter a number that would represent the number of months “Show next 3 months” => yes/no. Then, you would have to use the output of the parameter in your query using the parameter variable:

 

 {% parameter parameter_name %} Liquid variable in its sql parameter, which injects the selected value from item_to_add_up and changes the column name being referenced. The measure then performs the calculation on the referenced column:

Reply