CURRENCY DAX Function (Math and Trig)
Returns the value as a currency data type.
Syntax
Parameter | Attributes | Description |
---|---|---|
Value |
A scalar expression to be converted to currency data type. |
Return values
The value of the expression evaluated and returned as a currency type value.
Remarks
The CURRENCY function rounds up the 5th significant decimal, in value, to return the 4th decimal digit; rounding up occurs if the 5th significant decimal is equal to or larger than 5. For example, if the value is 3.6666666666666 then converting to currency returns $3.6667; however, if the value is 3.0123456789 then converting to currency returns $3.0123.
If the data type of the expression is Boolean then CURRENCY() will return $1.0000 for True values and $0.0000 for False values.
If the data type of the expression is String then CURRENCY() will try to convert string to a number; if the conversion succeeds the number will be converted to currency, otherwise, an error is returned.
If the data type of the expression is DateTime then CURRENCY() will convert the DateTime value to a number and that number to currency. DateTime values have an integer part that represents the number of days between the given date and 1900-03-01 and a fraction that represents the fraction of a day (where 12 hours or noon is 0.5 day). If the value of the expression is not a proper DateTime value, an error is returned.
The CURRENCY() function has the same behavior as calling CONVERT with a CURRENCY argument. The two following statements are equivalent:
CURRENCY ( <expression> ) CONVERT ( <expression>, CURRENCY )
» 1 related function
Examples
-- CURRENCY converts any expression in a CURRENCY datatype -- The Currency data type is called Fixed Decimal Number in Power BI -- This data type stores 4 digits after the decimal point EVALUATE { ( "Currency 1", FORMAT ( CURRENCY ( 10 ), "#.00000" ) ), ( "Currency 2", FORMAT ( CURRENCY ( TRUE ), "#.00000" ) ), ( "Currency 3", FORMAT ( CURRENCY ( "1950.00" ), "#.00000" ) ), ( "Currency 4", FORMAT ( CURRENCY ( 190.29876 ), "#.00000" ) ) }
Value1 | Value2 |
---|---|
2001-01-01 | 10.00000 |
2001-02-01 | 1.00000 |
2001-03-01 | 1950.00000 |
2001-04-01 | 190.29880 |
Related articles
Learn more about CURRENCY in the following articles:
-
Understanding numeric data type conversions in DAX
This article describes how DAX automatically converts data types in arithmetic operations. These small details can cause and explain differences in results when using the same operations in other languages. » Read more
-
Differences between INT and CONVERT in DAX
This article describes the small differences between INT and CONVERT in DAX that may end up returning different results in arithmetic expressions. » Read more
-
Rounding errors with different data types in DAX
This article describes the possible rounding differences that can appear in DAX. They are related to the data types and the operation being performed: knowing these details helps you write more robust DAX formulas and avoid errors in comparisons. » Read more
-
Impact of data types in DAX arithmetical calculations
The choice of data types can affect precision and performance because of internal conversions. This article shows how the right choice of data type and DAX code makes a significant difference. » Read more
Related functions
Other related functions are:
Last update: Nov 14, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber,
Microsoft documentation: https://docs.microsoft.com/en-us/dax/currency-function-dax