Component.GetCurrencyPosition

Get currency symbol positioning for specific currency code. Returns position information for proper currency formatting.

Syntax

DaxLib.FormatString.Component.GetCurrencyPosition ( currency_code )

Definition

DAX
// Get currency position based on currency code
// Returns either "PREFIX" or "SUFFIX"
(
    // 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 _Position =
        SELECTCOLUMNS ( _Currency, ''[Currency Position] )

    RETURN
        _Position

Parameters

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

Example

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

Use this function to get the positioning rule (PREFIX or SUFFIX) for a currency symbol. Based on Component.CurrencyTable

Related Functions