max

Learn how to use the max function in Notion formulas.

The max() function returns the greatest of one or more numbers. max() accepts only numbers or properties that output numbers (it will not auto-convert Booleans).

max(number)
max([number, number])
max(number, number, ...)

[number, number].max()
Code language: JavaScript (javascript)
max(3, 5, 4) /* Output: 5 */

/* Assume prop("Num") contains 20 */
[prop("Num"), 13, 5].max() /* Output: 20 */

[1, 2, 3].max(4, 5) /* Output: 5 */

/* Other data types must be converted to number */
max(1, toNumber(true), toNumber("3"), 9) /* Output: 9 */
/* Here, toNumber is used to conver true and "3" to numbers.
Code language: JavaScript (javascript)

Good to know: max() and min are useful for finding maximum and minimum values across multiple properties. They’re not useful for finding max/min values across multiple database rows.

For that, you’ll want to associate the rows to another common row via a Relation, then use a Rollup to calculate the max value among them. Here’s a small example database.

This approach still has limitations, but since Notion hasn’t provided a true query language for its database feature, it’s the best we can currently do (unless you create an external tool via the official API).

The example database below contains quarterly sales data for a fictional company. The Max property displays the dollar amount from the best quarter, while the Best Quarter property displays which quarter had the best performance.

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site
max(prop("Q1"), prop("Q2"), prop("Q3"), prop("Q4"))
Code language: JavaScript (javascript)

max() accepts numbers or number properties.

Here, we simply pass each quarter’s property to the max() function in order to find the maximum quarterly sales value.

if(
    prop("Q1") == prop("Max"),
    "Q1",
    if(
        prop("Q2") == prop("Max"),
        "Q2",
        if(
            prop("Q3") == prop("Max"),
            "Q3",
            "Q4"
        )
    )
)
Code language: JavaScript (javascript)

Here’s an example of how we can make max() more useful.

Using a nested if statement, we compare the numeric value of each quarter property to that of the Max property.

If a quarter’s value matches that of the Max property, we output that quarter’s name.

Other formula components used in this example:

if – Notion Formula Reference
Learn how to use the “if” operator in Notion formulas.
learn.thomasjfrank.com
About the Author

My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas