Skip to content
Learn › Clean and shape data: open the docs menu

Filter rows in Mammoth: keep or remove by condition

All plans · Project Editor or Project Admin · Updated 8 Nov 2026

Conditional Filter keeps or removes rows that match one or more conditions. Open it from Describe your transformation (or a + in the Pipeline panel) › Filter, Label & Replace › Conditional Filter; it is also a shortcut under AI Powered. Put filters early in the pipeline to cut the rows later tasks must process.

Filter rows step by step

Describe your transformation menu on Filter, Label & Replace, with Conditional Filter first under Filter

Step 1 of 6: Open Conditional Filter

Describe a filter in plain English

  1. Open Conditional Filter and click the prompt bar at the top (Describe what you want to generate in SQL mode).
  2. Type what you want, for example "Show entries where hotel class is 5-Star and region is Europe".
  3. Click Generate. Mammoth builds the condition in whichever mode is active. The revert button beside Generate goes back to the previous result.
  4. Check the result, then click Apply.

A saved filter reopens in the mode it was built in.

Combine conditions with AND, OR and brackets

  1. Click Condition to add another condition row.
  2. On the second row, choose And (both must be true) or Or (either is enough) in the dropdown.
  3. For (A AND B) OR (C AND D), click Group (with two or more conditions) to wrap the last condition and a new one in brackets. Each group has its own And/Or, worked out before the outer conditions.
Conditional Filter builder with the rule hotel_class is 5-Star and a WHERE clause preview

With more than one condition, each row has icons on the right:

IconAction
NestPlace inside parentheses: move this condition into a nested group
UnnestPlace outside parentheses: move it out of its group (only inside a group)
CopyDuplicate this condition row
TrashRemove this condition row

Write a filter as a SQL WHERE clause

A new filter opens in SQL mode. Type any valid SQL WHERE expression in the SQL Expression area, using your column names.

Conditional Filter SQL tab with an expression prompt, a Generate button and an empty SQL Expression editor
  • Write DuckDB SQL (pipeline steps run on DuckDB). Put column names in double quotes and text in single quotes, for example "region" = 'Europe' AND "amount" > 100.
  • The Describe what you want to generate bar's Generate fills the SQL Expression field.
  • Keep / Remove sits under the SQL / Builder toggle here too.
  • SQL mode has no Insert Parameter button, and {Region} text in a filter's SQL isn't read as a parameter. Use Builder with the Parameter comparison type instead.

Use SQL mode when the Builder can't express the logic, to paste a ready-made condition, or when moving logic from another tool. More in Calculate with formulas.

Filter from an Explore card

In a column's Explore card, select one or more values and choose Keep all values like this or Remove all values like this from the card's menu. A Conditional Filter opens in Builder with those values filled in. On a Text column, Case sensitive comes ticked. See Explore cards.

You can also choose Apply Filter with this Column in a column's 3-dot menu to open a filter set to that column.

Remove duplicate rows or keep the top rows

The same Filter group has Remove Duplicate Rows, which drops rows that match on all columns, all columns except some, or only the columns you pick, and keeps the last row of each set (Remove duplicate rows and add data quality checks). It also has Show Top/Bottom Rows, which keeps a fixed number of rows from the top or bottom:

Show Top/Bottom Rows panel with 5 rows set to Top and a Sort added summary sorted by order_amount descending
  1. In Type amount of rows, enter how many rows to keep. For a Number parameter, click the Val chip and choose Parameter.
  2. In Select rows position, choose Top or Bottom.
  3. Check the Sort added chip, if shown: the sort column decides what "top" means. Sorted by order_amount ascending, Top 10 gives the 10 lowest values. Edit or remove the sort from the chip.
  4. Click Apply.

Troubleshooting filters

SymptomCauseFix
The preview reads "No rows in the result."The condition matches nothing (with Keep) or everything (with Remove)Check the operator, the value and the Keep / Remove choice
A text filter misses rows that differ only in caseCase sensitive is tickedUntick it
A text filter catches rows with different casingCase sensitive is off by defaultTick Case sensitive
{Region} in a SQL filter isn't replacedFilter SQL doesn't read parametersUse Builder with the Parameter comparison type
Top 10 returns the lowest valuesThe sort is ascendingEdit the Sort added chip to sort descending
Was this page helpful?

Something wrong? support@mammoth.io