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.
For our Spotify analysis, we're going to add a date picker, and give it a name -start_date
.

Insert a control cell
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 ascontrol_cell_name.value
:

Connect a control cell
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
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 ourstart_date
control cell. Edit the title to beend_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!
Last modified 2mo ago