Filtering using the Data Pipeline

Data Pipeline

There might be a situation where you need to filter on a dropdown variable list in the Pipeline. Let’s say we have a dropdown variable control that lists all of the states. We want to select certain states in the dropdown and have our chart filter on those states. We could do this by dragging the state field into the filters, but we don’t want to do that because we need the initial query not to filter on any state selection; we need the filtering done in the Pipeline.

  1. Create the state dropdown by clicking Add Control in the sidebar and choosing Dropdown. Under Users, drag State into the Dimensions field. Name it something helpful, like STATE, and make sure Multi-select is unselected.
    State chart
  2. Clone the dataset by (after hitting Run Query), clicking the arrow next to Dataset 1 in the Pipeline and choosing Clone.
  3. Once you have the cloned dataset (it should be called Dataset 1 Clone), click the plus sign underneath Dataset 1 Clone and choose Add Column. Name the column and change the formula to Custom, with the formula being “State.”

    Add Column in Data Pipeline

  4. Below Dataset 1 Clone in the Pipeline, add an Edit Column step using the plus button. Choose the column that you named in step 3 and for the Custom formula, type

    CASE WHEN {DROPDOWN.IN('"state2"')} == '1=1' THEN "State" ELSE {DROPDOWN.IN('"state2"')} END

    a. Replace DROPDOWN with whatever you named your Dropdown filter in step 1 and state2 with whatever you named that column in step 3.
    Edit Column in the Data Pipeline

  5. Below the Edit Column step you just added, add a Filter Rows Pipeline step.

    Filter Rows in the Data Pipeline

  6. Add a Hide Column step to hide the Boolean State2 column.

Related Data Pipeline Help Articles

See more