Dax Function: CURRENCY

Category: Mathematical and Trigonometric Functions

The CURRENCY function in Power BI is a DAX function that converts a given value to a currency data type. This function is essential for financial modeling and calculations where monetary values are involved.

Purpose

The function is used to:

  1. Standardize numeric values as currency for financial computations.
  2. Format data for display purposes in financial reports.
  3. Enable precision in calculations by restricting values to four decimal places.

Type of Calculations

The CURRENCY function performs type casting by converting numeric or text values to the currency data type, which is stored with a fixed precision of four decimal places. It is particularly useful for ensuring that values adhere to monetary formatting.

Practical Use Cases

  1. Financial Analysis: Converting numeric values to currency for consistency in revenue, profit, or cost calculations.
  2. Data Cleansing: Ensuring monetary data from varied sources is standardized.
  3. Reporting: Formatting data as currency for financial dashboards.

CURRENCY(<value>)</value>

ParameterTypeDescription
<number>ScalarA numeric or text value to be converted to a currency type.


How Does CURRENCY Dax Function Works?

The CURRENCY function works by:

  1. Converting the input value to a decimal number with a fixed precision of four decimal places.
  2. Formatting the value as a monetary amount for financial operations.
  3. Handling rounding automatically if the input has more than four decimal places.

Key Notes

  • The currency data type supports values between −922,337,203,685,477.5808 and 922,337,203,685,477.5807.
  • Values outside this range result in an error.


What Does It Return?

The function returns a decimal number formatted as a currency type, with up to four decimal places of precision.

When Should We Use It?

  • When performing financial computations and needing precision to four decimal places.
  • For standardizing numeric inputs to the currency format in data models.
  • When building financial reports and dashboards that require currency formatting.

Examples

Basic Usage

Convert a numeric value 123.45678 to currency:


CURRENCY(123.45678)

Output: 123.4568

Column Usage

Convert all values in a column [Sales Amount] to currency:


= CURRENCY([Sales Amount])

Output: Each value in [Sales Amount] is formatted as a currency.

Advanced Usage

Combine the CURRENCY function with other DAX functions for complex calculations. For example, calculating total sales and converting to currency:

 

CURRENCY(SUM([Sales]))

Output: Total sales value as currency.

Tips and Tricks

    1. Avoid Data Overflow: Ensure input values are within the currency data type range to prevent errors.
    2. Use in Calculated Columns: Apply the function to create standardized currency columns for consistent reporting.
    3. Combine with Formatting: Use in conjunction with Power BI’s built-in formatting options for enhanced visualization.

    Potential Pitfalls

    • Data Type Errors: Applying the function to non-numeric or incompatible text values can result in errors.
    • Precision Loss: Ensure inputs are meaningful as values beyond four decimal places are rounded.

Performance Impact of CURRENCY DAX Function:

  • Efficient for financial computations but ensure large datasets are optimized for aggregation operations.
  • Use calculated columns instead of measures when converting entire datasets to currency.

Related Functions You Might Need

  • FORMAT: Formats a value as text in a specified format, including currency.
  • FIXED: Rounds a number to a specified number of decimals and returns as text.
  • ROUND: Rounds a number to a specified number of digits.
  • DIVIDE: Safely performs division operations, often used with currency calculations.

Want to Learn More?
For more information, check out the official Microsoft documentation for CURRENCY. You can also experiment with this function in your Power BI reports to explore its capabilities.

1. What does the CURRENCY function do in Power BI?

The CURRENCY function converts numeric or text values to a currency data type with a precision of four decimal places.

2. Can the CURRENCY function handle text inputs?

Yes, it can handle text inputs that represent numeric values, but incompatible text inputs will result in an error.

3. Is the CURRENCY function suitable for large datasets?

Yes, but ensure that data is pre-validated and optimized for aggregation operations to maintain performance.

4. How does the CURRENCY function handle values with more than four decimal places?

The function automatically rounds values to four decimal places.

5. What is the range of values supported by the CURRENCY function?

The currency data type supports values from −922,337,203,685,477.5808 to 922,337,203,685,477.5807