Filter rows in Mammoth: keep or remove by condition
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

Step 1 of 6: Open Conditional Filter
Describe a filter in plain English
- Open Conditional Filter and click the prompt bar at the top (Describe what you want to generate in SQL mode).
- Type what you want, for example "Show entries where hotel class is 5-Star and region is Europe".
- Click Generate. Mammoth builds the condition in whichever mode is active. The revert button beside Generate goes back to the previous result.
- Check the result, then click Apply.
A saved filter reopens in the mode it was built in.
Combine conditions with AND, OR and brackets
- Click Condition to add another condition row.
- On the second row, choose And (both must be true) or Or (either is enough) in the dropdown.
- 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.
With more than one condition, each row has icons on the right:
| Icon | Action |
|---|---|
| Nest | Place inside parentheses: move this condition into a nested group |
| Unnest | Place outside parentheses: move it out of its group (only inside a group) |
| Copy | Duplicate this condition row |
| Trash | Remove 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.
- 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:
- In Type amount of rows, enter how many rows to keep. For a Number parameter, click the Val chip and choose Parameter.
- In Select rows position, choose Top or Bottom.
- 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.
- Click Apply.
Troubleshooting filters
| Symptom | Cause | Fix |
|---|---|---|
| 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 case | Case sensitive is ticked | Untick it |
| A text filter catches rows with different casing | Case sensitive is off by default | Tick Case sensitive |
{Region} in a SQL filter isn't replaced | Filter SQL doesn't read parameters | Use Builder with the Parameter comparison type |
| Top 10 returns the lowest values | The sort is ascending | Edit the Sort added chip to sort descending |
Related
- Filter operators for text, number and date columns: every operator and date interval.
- Preview a task before you apply it: see the removed rows before applying.
- Label rows, edit cells and fill blanks: use the same conditions to label rows instead of removing them.
- How the pipeline works: where filters go in the pipeline.
Something wrong? support@mammoth.io



