Daily DAX : Day 306 CURRENCY

Power BI DAX CURRENCY Function

Description

The CURRENCY function in DAX (Data Analysis Expressions) converts a given value into the currency data type. It ensures that numerical values are treated as currency, which is useful for financial calculations and formatting in Power BI reports.

Syntax

CURRENCY(<value>)
  • value: The value or expression to convert to the currency data type. It can be a number, column, or expression that evaluates to a number.

Return Value

A value in the currency data type, which has a fixed precision of four decimal places.

Use Case

The CURRENCY function is used in scenarios where precise currency calculations are needed, such as in financial reports, budgeting, or sales analysis. It ensures consistent formatting and accuracy in calculations involving monetary values.

Example

Suppose you have a column Sales[Amount] with numerical values representing sales amounts. You want to ensure these values are treated as currency for calculations and display.

SalesAmountAsCurrency = CURRENCY(Sales[Amount])

This measure converts the Amount column to the currency data type. You can then use it in calculations, such as summing sales or applying currency formatting in visuals.

Practical Scenario

In a Power BI report for a retail company, you have a table with sales data, including a column Sales[Price]. To calculate total revenue with proper currency formatting, you create a measure:

TotalRevenue = SUMX(Sales, CURRENCY(Sales[Price]) * Sales[Quantity])

This ensures that the Price is treated as currency, and the result is formatted correctly in visuals, such as displaying "$1,234.5678" with four decimal places.

Notes

  • The currency data type in DAX supports up to four decimal places for precision.
  • Use this function when you need to ensure monetary values are consistently handled in calculations.
  • It does not apply currency symbols; formatting is applied in the Power BI report visuals.

Comments

Popular posts from this blog

Daily DAX : Day 65 INFO.TABLEPERMISSIONS

Daily DAX : Day 55 PV