Dynamic Vertical Reference Line

  • 23 August 2021
  • 1 reply

Hi, I want to make a vertical reference line for a specific date in a line graph (pivot) but I want to be able to change this specific date (not inside the code of the table dimension code because I have many graphs). Is there a way to make a dynamic vertical reference line? I used the following to make a vertical line but still need a way to make it dynamic. Maybe with a parameter that I could complete in the filter section?


 to_string(${}) = "2021-07-20"
 max(if(pivot_index(${table.sales},1) > pivot_index(${table.sales},2), pivot_index(${table.sales},1), pivot_index(${table.sales},2))), null




This topic has been closed for comments

1 reply

Userlevel 1

Hey there! Using a parameter is a good idea. I was thinking you could use something like the following: 

parameter: vertical_date{
type: date

dimension: vertical_date_value {
type: date
sql: {% parameter vertical_date %} ;;

Then you can include the vertical_date_value field in the explore (hiding it from the visualization). The table calculation would look something like this: 

if(${vertical_date_value} = ${created_date}, max(${count})+1, null)


Then changing the parameter value will update the vertical ref line :)