Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jackoline_2023
Regular Visitor

Currency Conversion with default currency

Good day

 

I have a currency conversion measure, but I want it to default to the South African Rand if no currency has been selected from the slicer, also Zimbabwe uses the US Dollar when capturing their amounts but when it is selected, it returns blank values and there is data for Zimbabwe.

 

My measure:

 

Total Amount with Currency =

Total Amount with Currency = SWITCH(TRUE(),
[Selected Currency] = "Mozambican Metical", "MT" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Naira", "₦" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Lesotho Loti", "L" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Zimbabwean Dollars", "$" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Malawian Kwacha", "MK" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Shilingi ya Kenya", "Ksh" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Tanzanian Shilling", "TSh" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Ugandan Shilling", "Ush" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Botswanan Pula", "P" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Congolese franc", "FC" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Zambian Kwacha", "K" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Angolan Kwanza", "Kz" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Tanzanian Shilling", "Tsh" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Ghanaian Cedi", "GH₵" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Mauritian Rupee", "Rs" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Namibian Dollar", "N$" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
 [Selected Currency] = "Swazi Lilangeni", "SZL" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"),
[Selected Currency] = "South African Rand", "R" & FORMAT([Claim Amount]*VALUES(TransactionCurrency[exchangerate]), "0,00"))

 

I tried adding this to the measure but it doesn't work, unless I comment out everything, for the default currency.

SELECTEDVALUE(TransactionCurrency[currencyname], "R" & [Claim Amount] )
 

Please assist me.

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @Jackoline_2023 

You can try the following code.

 

Total Amount with Currency =
SWITCH (
    TRUE (),
    [Selected Currency] = "Mozambican Metical",
        "MT"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Naira",
        "₦"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Lesotho Loti",
        "L"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Zimbabwean Dollars",
        "$"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Malawian Kwacha",
        "MK"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Shilingi ya Kenya",
        "Ksh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Tanzanian Shilling",
        "TSh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Ugandan Shilling",
        "Ush"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Botswanan Pula",
        "P"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Congolese franc",
        "FC"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Zambian Kwacha",
        "K"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Angolan Kwanza",
        "Kz"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Tanzanian Shilling",
        "Tsh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Ghanaian Cedi",
        "GH₵"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Mauritian Rupee",
        "Rs"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Namibian Dollar",
        "N$"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Swazi Lilangeni",
        "SZL"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    "R"
        & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" )
)

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @Jackoline_2023 

You can try the following code.

 

Total Amount with Currency =
SWITCH (
    TRUE (),
    [Selected Currency] = "Mozambican Metical",
        "MT"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Naira",
        "₦"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Lesotho Loti",
        "L"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Zimbabwean Dollars",
        "$"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Malawian Kwacha",
        "MK"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Shilingi ya Kenya",
        "Ksh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Tanzanian Shilling",
        "TSh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Ugandan Shilling",
        "Ush"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Botswanan Pula",
        "P"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Congolese franc",
        "FC"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Zambian Kwacha",
        "K"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Angolan Kwanza",
        "Kz"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Tanzanian Shilling",
        "Tsh"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Ghanaian Cedi",
        "GH₵"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Mauritian Rupee",
        "Rs"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Namibian Dollar",
        "N$"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    [Selected Currency] = "Swazi Lilangeni",
        "SZL"
            & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" ),
    "R"
        & FORMAT ( [Claim Amount] * VALUES ( TransactionCurrency[exchangerate] ), "0,00" )
)

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.