Int32.From

The function Int32.From returns a 32-bit integer number value from the input value. When the input value is null, Int32.From also returns null. If the input value is a number within the range of a 32-...

Syntax

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

About

The function Int32.From returns a 32-bit integer number value from the input value. When the input value is null, Int32.From also returns null. If the input value is a number within the range of a 32-bit integer with no decimal part, the value is directly returned. If the input value contains a decimal part, the number is rounded according to the specified rounding mode. The default rounding mode is RoundingMode.ToEven. If the input value is of a different data type, it will be first converted into a number using Number.FromText. For available rounding modes, refer to Number.Round. Additionally, a culture parameter can be optionally provided (e.g. "en-US").

Explanation

Obtain the 32-bit integer representation of the number "4". Syntax: Power Query MInt32.From("4") Result: 4 Obtain the 32-bit integer representation of the number "4.5" using the RoundingMode method, rounding away from zero. Syntax: Power Query MInt32.From("4.5", null, RoundingMode.AwayFromZero) Result: 5