Component.GetCurrencyFormat
Get currency format string for specific currency code. Returns appropriate format string based on currency positioning rules.
Syntax
DaxLib.FormatString.Component.GetCurrencyFormat ( currency_code )
Definition
DAX
// Get currency format based on currency code
// Returns simple currency format string (i.e. $#,##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] )
RETURN
_Symbol
Parameters
| Parameter | Type | Description |
|---|---|---|
currency_code |
ANYREF | Column with the currency code (e.g., "USD", "EUR", "GBP") |
Example
DaxLib.FormatString.Component.GetCurrencyFormat ( 'Exchange Rate'[Currency] )
Use this function to get the format string for a specific currency code. Based on Component.CurrencyTable
Related Functions
- Component.GetCurrencyFormat.PNZ - Positive/Negative/Zero version
- Component.GetCurrencySymbol - Get currency symbol
- Component.GetCurrencyPosition - Get currency position
- Component.CurrencyTable - Currency reference table