3. Parameterize your analysis

How to add filters and variables to your DAG.
In the Count canvas, you can add control cells to parameterize your analysis, and if you want, expose those parameters to canvas viewers to they can interact with the data too.
For our Spotify example, we're going to add a date range so we can only look at certain ranges of time.

1. Insert a control cell

You can insert a control cell from the Toolbar at the bottom of the screen.
For our Spotify analysis, we're going to add a date picker, and give it a name - start_date.
Insert a control cell

2. Inject our parameter into SQL

To connect our cell to our analysis, we'll need to bring it into our query.
💡 Under the hood, control cells are basically temporary tables. To test it out, try creating a new cell and querying: SELECT * FROM <control_cell_name>.
To get the value that we've chosen in our control cell, we can reference it as control_cell_name.value :
Connect a control cell

3. Give it a title

To make control cells more user-friendly, we can give them titles (like 'Select a start date') and hide the input.
If you're following along, then we can edit the control cell Title in the Design bar to be 'Select a start date:' and we can hide the input from the cell menu. Feel free to resize as needed.
Add control cell title

4. Duplicate to make an end date

Since we want a date range, we can duplicate the above steps to get a control cell for our end date.
Copy (with right click or with comand/control + c) and paste (right click or comand/control + v) to get a copy of our start_date control cell. Edit the title to be end_date, and update the title to be 'Select an end date:'. Make sure you update the initial date selected.
Create a date range
Now we have an analysis that we can easily tweak to explore our data more fully. Next stop...visuals!

Control cell FAQs:

What kind of control cells are available?
Count offers the following control cell types:
  • Single-select
  • Multi-select
  • Date picker
  • String input
  • Number input
  • Binary toggle
  • Range sliders
When I update a control cell selection, how do I make sure my results get updated?
Count canvases are reactive, meaning the results will update automatically when you update a control cell. You'll never have to worry about things getting out of sync.