<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" width="40px" /> As stated above, Notion does not currently provide a trunc() function. The example database below provides a working example of a trunc() polyfill (a.k.a. custom code that replicates the functionality of a missing function), which uses both floor() and ceil.

Floor and ceiling values are also provided for reference.

Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter

</aside>

Trunc Function in Notion

// Written with ternary operator (? and :)
prop("Num") >= 0 ? floor(prop("Num")) : ceil(prop("Num"))

// Written with if() and expanded
if(
    prop("Num") >= 0,
    floor(
        prop("Num")
    )
    ceil(
        prop("Num")
    )
)

© Thomas Frank