Int16.From

Number

Converts a value to a 16-bit signed integer (-32,768 to 32,767).

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

Syntax

Int16.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 16-bit signed integer in the range -32,768 to 32,767.

Remarks

Int16.From converts a value to a signed 16-bit integer (also called a "short integer"), covering the range -32,768 to 32,767. Values outside this range cause a runtime error. Fractional numbers are rounded before conversion; the default rounding mode is round-half-to-even (banker's rounding), not the conventional "round half up." Pass RoundingMode.AwayFromZero to match the rounding behavior you may expect from Excel or school arithmetic.

In database terms, this type maps to SMALLINT in SQL Server and many other databases. It is more compact than Int32 (32-bit) and substantially more compact than Int64 (64-bit). Use Int16.From when your source or destination system explicitly uses a 16-bit integer type and you need to match that schema precisely.

For most data transformation work, prefer Int64.From (the Whole Number type in Power BI) unless you have a specific reason to constrain values to 16 bits. Text values are parsed numerically; logical true converts to 1, false to 0, and null returns null.

Examples

Example 1: Convert a number within range

Int16.From(1000)
Result
Result
11,000

Example 2: Convert the maximum Int16 value from text

Int16.From("32767")
Result
Result
132,767

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

#table(
    {"Input", "Default (Banker's)", "AwayFromZero"},
    {
        {100.5, Int16.From(100.5), Int16.From(100.5, null, RoundingMode.AwayFromZero)},
        {101.5, Int16.From(101.5), Int16.From(101.5, null, RoundingMode.AwayFromZero)}
    }
)
Result
Input
Default (Banker's)
AwayFromZero
1100.50100101
2101.50102102

Compatibility

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