Skip to content

Lesson 17 ยท Controls and Interactivity

Controls and Filters

Add Sigma control elements, target tables and charts, use control values in formulas and SQL, and decide when to use controls, element filters or both.

A control is an element that lets a reader choose something: a region, a date range, a number or an on/off switch. With controls, one dashboard serves many questions without being copied for each one.

Control types

Sigma's documentation (as of December 2026) lists:

Group Controls
Choose from values List values, segmented control, Top N, hierarchy, legend
Text Text input, text area
Numbers Number input, number range, slider, range slider
Dates Date, date range
Yes or no Switch, checkbox
Navigation Drill down
Upload File upload (beta)

Pick the control that fits the choice. Three options suit a segmented control; hundreds suit a list.

Two jobs a control can do

  1. Filter elements: the control targets a column in one or more elements.
  2. Feed a formula or query: the control's value works like a parameter.

Filtering is the simplest. Using the value in formulas gives you more power.

Control IDs

Each control has an ID, created automatically. You use the ID to reference the control in formulas, custom SQL, embed URLs, URL parameters, some API endpoints and exports. You can change it, but changing it can break references. Changing the label is safe. A duplicated control gets a new ID, while synced controls share one.

Choose readable IDs early, such as Region-Picker.

Use a control in a formula

Suppose a number control with the ID Min-Amount:

TEXT
[Amount] >= [Min-Amount]

Make this a logical column, then keep rows where it is true. A segmented control can even switch which measure a chart shows:

TEXT
Switch([Metric-Choice],
       "Revenue", Sum([Revenue]),
       "Orders",  CountDistinct([Order ID]),
       "Units",   Sum([Qty]))

Label the axis or title with the chosen measure, so readers know what they are seeing.

Python Stand-in: a metric switcher driven by a parameter

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last line returns nothing because no case matches. In a real formula, decide what a missing or unexpected choice should show.

Control values in SQL

In custom SQL, Sigma documents that you reference a single-value control, such as a text or number input, by wrapping its ID in double curly brackets. The block below is a read-only illustration, not run in Sigma.

SQL
SELECT region, SUM(amount) AS total
FROM sales
WHERE region = {{Region-Input}}
GROUP BY region

Other control types work differently. A multi-select list produces a list of values, so you would write IN {{Region-Picker}} instead of =. Number ranges and date ranges are documented with a formula form, such as {{#formula [Amount-Range].min}} and .max, or {{#formula [Date-Window].start}} and .end. Behavior can also differ between data platforms, so check the generated SQL and the current documentation. A SQL element that depends on a control may need to run again when the value changes.

Element filters and Top N

Element filters live on a column; controls are separate elements that readers see and use. Filters on a parent affect its children, so Sigma's performance guidance suggests pointing shared controls and filters at a parent rather than at every child.

A Top N filter or control keeps the highest or lowest ranked items. According to the documentation, Top N results recalculate after other filters remove rows, so the "top 5 products" can change when the region changes. Also check what happens with ties.

SQL Stand-in: Top N depends on other filters

Press Run (or Ctrl + Enter) to see the result here.

Controls and security

Do not use a control to hide data that a user must not see. Sigma's row-level security guidance says to apply security filters directly on the element, because control values can be changed downstream. Controls are for convenience; security rules are for protection.

Controls and materialization

If you materialize (precompute) an element, targeting a control at it can be a problem. Sigma's guidance says not to target controls or filters at elements you materialize, but to materialize a parent and filter a child. You will see more in the performance lesson.

Design good controls

  • Set sensible defaults, such as the last full month.
  • Use plain labels: "Order region", not "dim_rgn".
  • Order controls from broad to narrow.
  • Handle empty results with a clear message.
  • Avoid too many controls; each one is a decision for the reader.

Common mistake: renaming a control ID after building formulas, embed links or SQL that use it. Those references can break. Set good IDs first, and change only the label later.

A worked design

Imagine a support dashboard that three groups share. Managers want to choose a team, analysts want to choose a date range, and everyone wants to switch between ticket counts and average age.

Start with the date range, since it limits the data the most. Give it the ID Date-Window and target the date column of the parent table. Add a team list with the ID Team-Picker, targeting the same parent. Both choices then flow to every child chart. Finally, add a segmented control with the ID Measure-Choice that feeds the chart formula, with just two options.

Now test the awkward cases. What happens when no team is selected: does the page show all teams or nothing? What happens when the date window contains no tickets? Does the title change when the measure changes? Write the expected behavior next to each question, then try it in a viewer preview.

Last, consider who should see each team's data. If some readers must never see other teams, the team picker is not enough, however you set its default. That requirement belongs to row-level security, and the picker only narrows what a person is already allowed to see.

Repeat these tests after you add a new element, because it may not be connected to the existing controls yet.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What do formulas and SQL use to refer to a control?

    The control ID is the reference, while labels are for readers.
  2. 2. Where should shared controls usually point for performance?

    Filtering the parent lets the children inherit it.
  3. 3. Why not use a control as row-level security?

    Security filters should be applied directly on the element with user-based rules.
  4. 4. A Top 5 list changes when you select a region. Why?

    Other filters narrow the data, which changes which items rank highest.

Summary

  • Controls filter elements and supply values to formulas and SQL.
  • Use clear, stable control IDs.
  • Point shared controls at parents and set helpful defaults.
  • Top N results move with other filters.
  • Never use controls as a security boundary.

Next: Actions and Interactivity

Your progress is saved in this browser. No account needed.