Component.GetCurrencyFormat.PNZ

Get currency format string with positive/negative/zero handling. Returns complete format strings that handle different value states.

Syntax

DaxLib.FormatString.Component.GetCurrencyFormat.PNZ ( currency_code )

Definition

DAX
// Get currency format based on currency code
// Returns positive; negative; zero format string (i.e. $#,##0.0; ($-#,##0.0); $0)
(
    // Currency code (ISO 4217 three-letter code)
    // Examples: CAD, EUR, GBP, JPY, etc.
    currency_code: ANYREF
)
=>
    VAR _Code =
        SELECTEDVALUE ( currency_code )

    VAR _Currency =
        FILTER (
            -- Calc. table with common currencies and formats
            -- Optionally replace with your own, in-memory exchange rate table
            DaxLib.FormatString.Component.CurrencyTable(),
            ''[Currency Code] = _Code
        )

    VAR _Symbol =
        SELECTCOLUMNS ( _Currency, ''[Format String PNZ] )

    RETURN
        _Symbol

Parameters

Parameter Type Description
currency_code ANYREF Column with the currency code (e.g., "USD", "EUR", "GBP")

Example

DaxLib.FormatString.Component.GetCurrencyFormat.PNZ ( 'Exchange Rate'[Currency] )

Use this function to get the positive/negative/zero format string for a specific currency code. Based on Component.CurrencyTable

Related Functions