Prompt Users to Enter a Filter Value

Oftentimes we want our end users to select a filter in order to use a dashboard. One of the ways we can do this is by building it into then chart SQL, as shown below:

select
  case
    when '[source_test|default]' = 'default'
      then 'Please select a filter value'
    else '[source_test]'
  end as source
  , case
    when '[source_test|default]' = 'default'
      then null
    else count(*)
  end as number_of_users
from
  users
where
  [source=source_test]
group by
  1

This approach leverages direct replacement filters and the default pipe notation to control the behavior of the query when no filter value is selected. With the [source_test|default] notation, we inject the value to the right of the | if no filter value is selected. Therefore, when no filter is selected, we get 'default'='default', a true statement. Otherwise we go into our else clause. Note that similar logic can be implemented in the where clause of a query as well.

If no filter value is selected, we will see a result like this:

 

If we do select a filter value, then we will see results:

  

Other ways you can encourage end-users to perform a certain action are:

  • Creating number overlays with instructions on how to interact with the dashboard
  • If the description is too large for a number overlay, consider creating an Image with the text you want to show and displaying that on the top of your dashboard
  • Other ideas? Comment below!
Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
reply to topic
Like1 Follow
  • 1 Likes
  • 4 wk agoLast active
  • 408Views
  • 1 Following