Decimal.From

Number

Converts a value to a decimal (fixed-point) number with high precision for exact decimal arithmetic.

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

Syntax

Decimal.From(value as any, optional culture as nullable text) 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.

Return Value

numberA decimal number with exact fixed-point representation.

Remarks

Decimal.From converts a value to the decimal number type, which uses fixed-point arithmetic rather than binary floating-point. In Power Query M, "Decimal Number" in the UI corresponds to this type, which maps to the .NET Decimal type with 28–29 significant digits of precision. The default number type in M is a 64-bit IEEE 754 double, which cannot represent all decimal fractions exactly.

The most practical implication is that values like 0.1, 0.2, and 0.3 are stored exactly as Decimal but are approximated in binary floating-point (double). Summing thousands of currency or tax amounts using double arithmetic can introduce small cumulative rounding errors that would not occur with decimal arithmetic. For this reason, Decimal.From is preferred over Double.From in financial data modeling.

Compared to Currency.From, the decimal type is more general: it is not limited to 4 decimal places and supports up to 28–29 significant digits. Use Decimal.From when you need high-precision fixed-point arithmetic without the 4-decimal-place constraint of the currency type. Text values are parsed using the specified culture — pass "de-DE" for German-format numbers, for example. Logical true converts to 1, false to 0, and null returns null.

Examples

Example 1: Exact decimal arithmetic avoids floating-point drift

Decimal.From(0.1) + Decimal.From(0.2)
Result
Result
10.30

Example 2: Parse a text value with 4 decimal places

Decimal.From("1234.5678")
Result
Result
11,234.57

Example 3: Apply decimal type to price column in Sales

Table.TransformColumnTypes(
    Table.SelectColumns(Table.FirstN(Sales, 4), {"OrderID", "CustomerName", "UnitPrice"}),
    {{"UnitPrice", Decimal.Type}}
)
Result
OrderID
CustomerName
UnitPrice
11Alice25
22Bob50
33Charlie15
44Alice75

Compatibility

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