Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Currency Formatting

Thank you to all who respond,

 

My goal is to show the currency symbol for US and Euro when the slicer is selected. The slicer is working correctly but I can't seem to get the correct DAX for formatting the field. My code:

 

Converted Sales =
VAR _CurrencySelected = [Currency Selected]
VAR _Sales = [Total Sales]
VAR _Rate =
LOOKUPVALUE(
FactCurrencyRates[Crossrate]
,FactCurrencyRates[Ticker], _CurrencySelected
)

var _ConvertedMeasure = _Sales * _Rate

RETURN
_ConvertedMeasure
 
 
 

This is where I need help.

 

FORMAT _Sales

SWITCH(
//SELECTEDVALUE('DimCurrencyRates'[Ticker], "USD"),
//"USD","$#,##0",
// "EUR","€#,##0"
//))
  • Anonymous's avatar
    Anonymous
    4 years ago

    Theo,

     

    DimCurrencyRates table is shown below.

     

     

  • Hi Anonymous  ,

     

    You can try this:-

     

    FORMAT_Sales = 
    SWITCH(
    SELECTEDVALUE('DimCurrencyRates'[Fullname]),
    "US Dollar",FORMAT([Converted Sales],"$#,##0"),
    "EURO",FORMAT([Converted Sales],"€#,##0")
    )

     

     

    Thanks,

    Samarth

3 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous  ,

     

    You can try this:-

     

    FORMAT_Sales = 
    SWITCH(
    SELECTEDVALUE('DimCurrencyRates'[Fullname]),
    "US Dollar",FORMAT([Converted Sales],"$#,##0"),
    "EURO",FORMAT([Converted Sales],"€#,##0")
    )

     

     

    Thanks,

    Samarth

  • TheoC's avatar
    TheoC
    Community Champion

    Hi Anonymous 

     

    How have you structured your DimCurrencyRates table?  Does it include a Format column within it?  If not, certainly recommend it. From there, you can incorporate LOOKUPVALUE with CONCATENATE.

     

    Link to an article that explains it in some detail: https://blog.enterprisedna.co/format-currencies-in-power-bi-using-dax/

     

    Hope this helps.

    Theo

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Theo,

       

      DimCurrencyRates table is shown below.