Byte.From
The function Byte.From returns an 8-bit integer number value based on the input value provided. If the input value is null, then Byte.From will also return null. If the input value is a number within ...
Byte.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable number
The function Byte.From returns an 8-bit integer number value based on the input value provided. If the input value is null, then Byte.From will also return null. If the input value is a number within the range of an 8-bit integer and does not have a fractional part, the same value is returned. In case the input value has a fractional part, it will be rounded using the specified rounding mode. The default rounding mode is RoundingMode.ToEven. If the input value is of a different type, it will be first converted to a number using Number.FromText. Different rounding modes are available, please refer to Number.Round for more information. Additionally, an optional culture parameter can be included, for example, "en-US".
Retrieve the 8-bit integer value of the numeric string "4" by utilizing the Power Query MByte function.
Input: Power Query MByte.From("4")
Output: 4
Obtain the 8-bit integer value of the numeric string "4.5" while incorporating the RoundingMode.AwayFromZero.
Input: Power Query MByte.From("4.5", null, RoundingMode.AwayFromZero)
Output: 5