Int32.From
NumberConverts a value to a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).
Syntax
Int32.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value to convert. Accepts number, text, logical, or null. |
culture | text | No | An optional culture string for locale-aware parsing of text values. |
roundingMode | number | No | An optional rounding mode constant used when truncating fractional values. |
Return Value
number — A 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 | |
|---|---|
| 1 | 2,147,483,647 |
Example 2: Convert a negative text value
Int32.From("-100000")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)}
}
)Input | Default (Banker's) | AwayFromZero | |
|---|---|---|---|
| 1 | 99.50 | 100 | 100 |
| 2 | 100.50 | 100 | 101 |