Int32.From

Number

Converts a value to a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Int32.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable number

Parameters

NameTypeRequiredDescription
valueanyYesThe value to convert. Accepts number, text, logical, or null.
culturetextNoAn optional culture string for locale-aware parsing of text values.
roundingModenumberNoAn optional rounding mode constant used when truncating fractional values.

Return Value

numberA 32-bit signed integer in the range -2,147,483,648 to 2,147,483,647.

Remarks

Int32.From converts a value to a signed 32-bit integer — the most widely used integer size in relational databases and programming languages. It covers the range -2,147,483,648 to 2,147,483,647. Values outside this range cause a runtime error; use Int64.From if your data may contain larger integers (for example, large primary key sequences or Unix timestamps in milliseconds).

The default rounding mode when converting fractional values is round-half-to-even (banker's rounding), not the conventional "round half up." This matches the IEEE 754 standard and avoids systematic bias when rounding large datasets, but may surprise users accustomed to spreadsheet arithmetic. To get conventional rounding, pass RoundingMode.AwayFromZero.

This type maps to INT or INTEGER in SQL Server, SQLite, and most other databases. In Power BI Desktop, it is labeled "Whole Number" — the same label shared with Int64, so the distinction is primarily relevant when building custom connector schemas or when memory efficiency of 32 vs. 64 bits matters. Text values are parsed numerically; logical true converts to 1, false to 0, and null returns null.

Examples

Example 1: Convert the maximum Int32 value

Int32.From(2147483647)
Result
Result
12,147,483,647

Example 2: Convert a negative text value

Int32.From("-100000")
Result
Result
1-100,000

Example 3: Rounding — default banker's rounding vs. away-from-zero

#table(
    {"Input", "Default (Banker's)", "AwayFromZero"},
    {
        {99.5, Int32.From(99.5), Int32.From(99.5, null, RoundingMode.AwayFromZero)},
        {100.5, Int32.From(100.5), Int32.From(100.5, null, RoundingMode.AwayFromZero)}
    }
)
Result
Input
Default (Banker's)
AwayFromZero
199.50100100
2100.50100101

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks