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. The same Filter group has Remove Duplicate Rows and Show Top/Bottom Rows. 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.
  2. Click the prompt bar at the top (Describe what you want to generate in SQL mode).
  3. Type what you want, for example "Show entries where hotel class is 5-Star and region is Europe".
  4. Click Generate. Mammoth builds the condition in whichever mode is active.
  5. Check the result, then click Apply.

Use the revert button beside Generate to go back to the previous result.

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

Compare with a value, a column or a parameter

Click the chip in front of the input (Val, Col or #) to choose what the column is compared with.

Comparison typeUse it to
ValueCompare against a fixed value you type. Suggestions come from the column's real data.
Column ValueCompare against another column in the same row, for example keep rows where actual_sales is greater than target_sales.
ParameterCompare against a project parameter. The picker lists parameters whose type matches the column, and each run uses the parameter's current value. See Parameters and snippets.

A Case sensitive checkbox appears below the conditions once at least one Text condition exists. Unticked (the default), comparisons like is, contains and starts with ignore case. Tick it when exact casing matters.

Operators for each column type

The column's type decides the operators you can pick.

Operators for text columns

OperatorKeeps rows where the value…
isexactly equals the value, or any one of several values you enter
is notdoesn't equal the value, or any of several values you enter
containsincludes the text, or any one of several texts you enter, anywhere
does NOT containdoesn't include the text anywhere
starts withbegins with the text
ends withends with the text
does NOT start withdoesn't begin with the text
does NOT end withdoesn't end with the text
is Emptyis null or blank
is NOT Emptyhas any non-null, non-blank value

Operators for number columns

OperatorKeeps rows where the value…
isexactly equals the number, or any one of several numbers you enter
is notdoesn't equal the number, or any of several numbers you enter
is less thanis strictly less than the number
is less than or equal tois less than or equal to the number
is greater thanis strictly greater than the number
is greater than or equal tois greater than or equal to the number
is MAX valueequals the column's maximum
is NOT MAX valuedoesn't equal the maximum
is MIN valueequals the column's minimum
is NOT MIN valuedoesn't equal the minimum
is Emptyis null
is NOT Emptyhas any non-null value
in between (exclusive)falls between two numbers, not including the endpoints

On a Number column marked as an ID, starts with and does NOT start with are also offered, near the top after is and is not. They match on the digits, so starts with 40 keeps 4012 and 40877.

Operators for date columns

OperatorKeeps rows where the date…
isequals the date
is NOTdoesn't equal the date
is later thanis after the date
is on or later thanis on or after the date
is earlier thanis before the date
is on or earlier thanis on or before the date
in between (exclusive)falls between two dates, not including the endpoints
is Emptyis null
is NOT Emptyhas any non-null value

Filter dates by month, weekday, year or a rolling window

On a Date column with the Value comparison type, a Select time interval dropdown appears before the value. It sets how precisely dates are compared and what you enter. in between (exclusive) skips it and shows a date-time picker for each end.

Time intervalYou enterThe condition compares
DateA dateThe date, ignoring the time of day
Date - Time in secondsA date and time to the secondDate and time, to the second
Date/MinuteA date and timeDate and time, to the minute
Date/HourA date and hourDate and time, to the hour
Year/MonthA year and a monthYear and month only
YearA yearYear only
Day of MonthA day from 1 to 31The day of the month in any month and year
MonthA month nameThe month in any year
WeekdayA weekdayThe day of the week
Earliest single valueNothingThe earliest date in the column
Latest single valueNothingThe latest date in the column
Earliest Date - TimeA number and a unit (Year to Second)The earliest date in the column plus that amount
Latest Date - TimeA number and a unit (Year to Second)The latest date in the column plus that amount. Enter a negative number to go back.
Current Date (UTC)A number and a unit (Year, Month, Week or Day)The UTC date the step runs, plus that amount

Earliest, latest and current date options are worked out again each time the pipeline runs.

To keep the last 30 days, choose is on or later than, set the interval to Current Date (UTC), and enter -30 Days. The window moves forward on every run.

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. To build compound logic such as (A AND B) OR (C AND D), click Group (available with two or more conditions) to wrap the last condition and a new one in brackets; each group has its own And/Or. The AND/OR inside a group is worked out first, then combined with 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

SQL mode is where a new filter opens. 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
  • Pipeline steps run on DuckDB, so write DuckDB SQL. 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 still works: Generate fills the SQL Expression field.
  • Keep / Remove sits under the SQL / Builder toggle here too. Write the condition for the rows to match, then pick whether they stay or go.
  • SQL mode has no Insert Parameter button, and {Region} text in a filter's SQL isn't read as a parameter. To compare against a parameter, switch to Builder and use the Parameter comparison type.

Use SQL mode when the Builder can't express the logic, when you want to paste a ready-made condition, or when you are moving logic from another tool. More on SQL expressions 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

Remove Duplicate Rows sits in the same Filter group. It 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. Settings and an example are in Remove duplicate rows and add data quality checks.

Keep only the top or bottom rows

Show Top/Bottom Rows keeps a fixed number of rows from the top or bottom of your data.

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. To use a Number parameter, click the Val chip and choose Parameter.
  2. In Select rows position, choose Top for the first rows or Bottom for the last.
  3. Check the Sort added chip, if shown. It shows the column the data is sorted by, which 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