Power BI-使用度量值的动态格式字符串实现基于货币符号的汇率换算

1.表


Country Currency Format String

Yearly Average Exchange Rates

2.度量值

计算年均汇率:以美元作为标准,汇率为1,其他国家/地区按各自的年均汇率

AVG RATE = 
IF( 
    ISBLANK(SELECTEDVALUE('Country Currency Format String'[Country]))
    || SELECTEDVALUE('Country Currency Format String'[Country])="United States",
    1,
    AVERAGE('Yearly Average Exchange Rates'[Yearly Average Exchange Rates])
)

对基础度量进行汇率换算

Converted Sales = [Sales Amount]*[AVG RATE]

3.设置动态度量值


image.png
//选择国家币种格式,否则默认展示美元符号
SELECTEDVALUE (
    'Country Currency Format String'[Format],
    "\$#,0.00;(\$#,0.00);\$#,0.00"
)
image.png

你可能感兴趣的:(Power BI-使用度量值的动态格式字符串实现基于货币符号的汇率换算)