Notion Formula 2.0 introduced the Map() and Filter() functions, which let you transform and filter arrays directly inside a formula. Before Formula 2.0, you had to rely on rollups or external tools to process lists of values. This article explains how Map() and Filter() work, shows practical examples you can copy and adapt, and covers common mistakes that break these formulas.
Key Takeaways: Map() and Filter() in Notion Formula 2.0
- Map( array, expression ): Applies an expression to every element of an array and returns a new array of the same length.
- Filter( array, condition ): Returns a new array containing only elements that satisfy a given condition.
- Combine with current.value: Inside Map and Filter, use
current.valueto refer to each individual element of the input array.
How Map and Filter Work in Notion Formula 2.0
Map() and Filter() are array functions. An array is a list of values, such as [1,2,3] or [“a”,”b”,”c”]. In Notion databases, arrays often come from rollup properties, multi-select properties, or formula properties that return lists.
Map() takes two arguments: an array and an expression. The expression is evaluated once for each element in the array. Inside the expression, the variable current.value represents the current element. The result of Map() is a new array where each element is the result of the expression applied to the original element. For example, Map([1,2,3], current.value + 1) returns [2,3,4].
Filter() also takes two arguments: an array and a condition. The condition is a boolean expression. For each element where the condition evaluates to true, that element is included in the output array. For example, Filter([1,2,3,4], current.value > 2) returns [3,4].
Both functions are available only in Notion Formula 2.0. If your database was created before this update, you must enable Formula 2.0 in the formula editor by clicking the gear icon and selecting “Use Formula 2.0”.
Practical Examples of Map() and Filter()
Example 1: Double Every Number in a Rollup
Suppose you have a rollup property named “Scores” that returns a list of numbers, such as [10, 20, 30]. You want a formula that doubles each score.
- Create a new formula property
Add a formula property to your database and name it “Doubled Scores”. - Enable Formula 2.0
Click the formula editor gear icon and select “Use Formula 2.0”. - Enter the Map expression
Type:Map(prop("Scores"), current.value 2)
This will return [20, 40, 60].
Example 2: Filter Products Above a Price Threshold
Imagine a “Products” rollup that returns a list of prices, like [5.99, 12.50, 3.25, 20.00]. You want only prices above $10.
- Create a formula property
Name it “Expensive Items”. - Write the Filter expression
Type:Filter(prop("Products"), current.value > 10)
Result: [12.50, 20.00].
Example 3: Combine Map and Filter to Transform Filtered Results
You want to double only the scores above 15 from the rollup “Scores”.
- Use Filter inside Map
Type:Map(Filter(prop("Scores"), current.value > 15), current.value 2)
If “Scores” is [10, 20, 30], the result is [40, 60].
Example 4: Extract Names from a Multi-Select Property
A multi-select property named “Tags” might contain multiple values like “Urgent”, “Design”, “Bug”. You want a formula that returns only tags that start with “D”.
- Use Filter with a string condition
Type:Filter(prop("Tags"), startsWith(current.value, "D"))
Result: [“Design”].
Example 5: Convert Strings to Uppercase
You have a rollup that returns a list of product names, like [“apple”, “banana”, “cherry”] and you want them all uppercase.
- Use Map with the upper function
Type:Map(prop("Product Names"), upper(current.value))
Result: [“APPLE”, “BANANA”, “CHERRY”].
Common Mistakes and Limitations
Forgetting to Enable Formula 2.0
If you type Map() or Filter() and the formula editor does not recognize them, open the gear icon and switch to Formula 2.0. Without this step, the functions will not exist.
Passing a Non-Array to Map or Filter
Map and Filter only work with arrays. If you pass a single number or a text string, the formula will return an error. Verify that the source property is a rollup, multi-select, or another formula that returns an array.
Using current.value Outside the Expression
The variable current.value is only defined inside the Map or Filter expression. If you try to use it outside, the formula will break. Always nest your logic inside the function call.
Nesting Too Many Functions
You can nest Map and Filter, but each level adds complexity. For readability, break complex transformations into separate formula properties when possible.
Result Display Limitations
The output of Map and Filter is an array. In a Notion database, an array is displayed as a comma-separated list inside the formula cell. If the array is very long, Notion may truncate the display. The underlying data remains complete but may not be fully visible.
Map and Filter vs Alternative Approaches
| Feature | Map / Filter | Rollup with aggregation | Manual calculation |
|---|---|---|---|
| Transforms each element | Yes, per element | No, only aggregate (sum, average) | Not possible |
| Filters elements | Yes | No | Not possible |
| Requires Formula 2.0 | Yes | No | No |
| Works with multi-select | Yes | No | No |
| Output type | Array | Single value | Single value |
Map and Filter give you control over each element in an array. Rollups only give you a summary. If you need to modify or select specific items from a list, Map and Filter are the correct tools.
You can now use Map() to transform arrays and Filter() to extract subsets of data inside Notion formulas. Try the examples above with your own database properties. For advanced use, nest a Filter inside a Map to apply a transformation only to elements that meet a condition. Remember that current.value is your key to accessing each element.