Int64.From
A value as a whole number of the Int64.Type kind, the one Power Query's Whole number columns hold.
Group: Values, types and errors. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Int64.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable number
| Parameter | Type | Description |
|---|---|---|
value | any | The value to convert: a number, text, a logical, a date, datetime, time or duration; null gives null. |
culture | nullable text optional | The culture text is read in, such as "nb-NO"; the query's culture when left out. |
roundingMode | nullable number optional | Where a half goes: RoundingMode.ToEven (the default), RoundingMode.AwayFromZero, RoundingMode.Up, RoundingMode.Down or RoundingMode.TowardZero. Any other fraction goes to the nearest number whatever the mode. |
Returns
nullable number. The whole number; null for null.
Remarks
- Text is read in the culture, the way
Number.Fromreads it; a value that isn't a number is an error. - A fraction is rounded to the nearest whole number. A half goes to the even neighbour unless a rounding mode says otherwise: 4.5 becomes 4 and 5.5 becomes 6. The mode is used for a half only, so 12.1 is 12 even with
RoundingMode.Up. - A number outside the type's range is an error, as in Power Query: from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Table.TransformColumnTypeswithInt64.Typeturns a whole column the same way.
Examples
Text with a half
Int64.From("4.5")
4
Halves go to the even neighbour.
Halves away from zero
Int64.From(4.5, null, RoundingMode.AwayFromZero)
5
A thousands separator
Int64.From("1,234")
1234
Related functions
Int32.From, Number.From, Number.Round, Table.TransformColumnTypes.