Decimal.From
A value as a decimal number (Decimal.Type), read in the query's culture or in one you name.
Group: Values, types and errors. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Decimal.From(value as any, optional culture as nullable text) 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. |
Returns
nullable number. The number; null for null.
Remarks
- Text is read as
Number.Fromreads it; a value that isn't a number is an error. - A computed number keeps the 15 significant digits Power Query shows for it: one third is 0.333333333333333.
- The answer is still a number like any other: adding two of them is ordinary arithmetic, so
Decimal.From("0.1") + Decimal.From("0.2")is 0.30000000000000004, in Power Query too. For sums in decimal arithmetic, giveList.SumorValue.Addthe precisionPrecision.Decimal.
Examples
Text
Decimal.From("4.5")
4.5
Norwegian number text
Decimal.From("1 234,5", "nb-NO")
1234.5
One third
Decimal.From(1 / 3)
0.333333333333333