Int64.From
NumberConverts a value to a 64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).
Syntax
Int64.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 64-bit signed integer (long integer).
Remarks
Int64.From converts a value to a signed 64-bit integer — the largest fixed-size integer type in Power Query M, covering approximately ±9.2 × 10^18. This is the type displayed as "Whole Number" in the Power BI Desktop data type menu, making it the standard integer type for most data modeling work. It maps to BIGINT in SQL Server and equivalent 64-bit integer types in other databases.
Use Int64.From for primary key columns, row counts, Unix epoch timestamps (milliseconds), and any integer data where values might exceed the 32-bit range (-2.1B to 2.1B). For the vast majority of integer use cases in Power BI models, Int64.From is the right choice over Int32.From or Int16.From, as the memory overhead difference is rarely significant compared to the risk of overflow.
The default rounding mode is round-half-to-even (banker's rounding), not conventional "round half up." Pass RoundingMode.AwayFromZero for conventional behavior. Note that a 64-bit integer stores up to 19 significant digits, whereas M's default number type (double-precision float) only has ~15–17 significant digits — so for very large integers, converting to Int64.From may lose no precision whereas the double representation would. Text values are parsed numerically; logical true converts to 1, false to 0, and null returns null.
Examples
Example 1: Convert a large integer value
Int64.From(9007199254740992)Result | |
|---|---|
| 1 | 9,007,199,254,740,992 |
Example 2: Parse a large integer from text
Int64.From("1234567890123")Result | |
|---|---|
| 1 | 1,234,567,890,123 |
Example 3: Apply Whole Number type to the OrderID column in Sales
Table.TransformColumnTypes(
Table.SelectColumns(Table.FirstN(Sales, 4), {"OrderID", "CustomerName"}),
{{"OrderID", Int64.Type}}
)OrderID | CustomerName | |
|---|---|---|
| 1 | 1 | Alice |
| 2 | 2 | Bob |
| 3 | 3 | Charlie |
| 4 | 4 | Alice |