Currency.From

Updated on

Currency.From is a function in the Power Query M language that returns a currency value from the given value. If the value is null, the function returns null. If the value is within the range of currency, the fractional part of the value is rounded to 4 decimal digits and returned.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Currency.From(
   value as any,
   optional culture as nullable text,
   optional roundingMode as nullable number,
) as nullable number
Argument Attribute Description
value
culture optional The culture argument enables the specification of a Culture code (e.g., “nl-NL” or “en-US”) to align transformations with local formatting conventions. If this argument is omitted, functions default to Culture.Current, which reflects the system’s regional settings.
roundingMode optional The RoundingMode.Type argument controls the rounding method applied. When omitted, the function uses RoundingMode.ToEven, which rounds to the nearest even number in tie situations. Other options include:
RoundingMode.Up rounds up in such cases.
RoundingMode.Down rounds down.
RoundingMode.TowardZero rounds toward zero.
RoundingMode.AwayFromZero rounds away from zero.

Description

Returns a currency value from the given value. If the given value is null, Currency.From returns null. If the given value is number within the range of currency, fractional part of the value is rounded to 4 decimal digits and returned. If value is of any other type, it will first be converted to a number using Number.FromText. Valid range for currency is -922,337,203,685,477.5808 to 922,337,203,685,477.5807. Refer to Number.Round for the available rounding modes. The default is RoundingMode.ToEven. An optional culture may also be provided (for example, “en-US”).

Examples

Get the currency value of "1.23455".

// Output: 1.2346
Currency.From( "1.23455" )

Get the currency value of "1.23455" using RoundingMode.Down.

// Output: 1.2345
Currency.From( "1.23455", "en-US", RoundingMode.Down )

Other functions related to Currency.From are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/currency-from