Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Currency Conversion

Thank you to all who reply.

 

I need to convert my sales revenue USD over to EUR and also be able to switch back to USD.

 

Conversion table "HistoryExchangeReport". 

 

DateRateISO Code From      ISO Code To
2/23/2022        0.825355    EURUSD
2/23/2022   1.2116    USDEUR

 

How could I create the measure to use with a slicer to toggle back and forth?

 

Thanks!!

BLD

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you for responding!,

     

    I've got my issue resolved. Thank you for your response. I was unable to find a way to attach the sample .pbix file so see code below for what is working.

     

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

    var _ConvertedMeasure = _Sales * _Rate

    RETURN
    _ConvertedMeasure
     

     

     

     

    Finally what I am struggling with is finding a way to show the EURO sign when selected. Right now it would still display the USD dollar sign $ for Euros. Difficult trying to format for euro.

4 Replies

  • Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck? How do you envision the visuals to work?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for responding!,

       

      I've got my issue resolved. Thank you for your response. I was unable to find a way to attach the sample .pbix file so see code below for what is working.

       

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

      var _ConvertedMeasure = _Sales * _Rate

      RETURN
      _ConvertedMeasure
       

       

       

       

      Finally what I am struggling with is finding a way to show the EURO sign when selected. Right now it would still display the USD dollar sign $ for Euros. Difficult trying to format for euro.

  • v-kkf-msft's avatar
    v-kkf-msft
    Community Support

    Hi Anonymous ,

     

    Please try the following formula:

     

     

    Measure =
    VAR LatestDate =
        MAXX ( ALLSELECTED ( 'Rate Table' ), 'Rate Table'[Date] )
    VAR LatestRate =
        CALCULATE (
            SELECTEDVALUE ( 'Rate Table'[Rate] ),
            FILTER ( ALLSELECTED ( 'Rate Table' ), 'Rate Table'[Date] = LatestDate )
        )
    VAR Sales =
        SUM ( 'Sales Table'[Amount] )
    RETURN
        IF (
            SELECTEDVALUE ( 'Rate Table'[ISO Code To] ) = "USD",
            Sales,
            Sales * LatestRate
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you Winniz,

       

      I've got my issue resolved. Thank you for your response. I was unable to find a way to attach the sample .pbix file so see code below for what is working.

       

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

      var _ConvertedMeasure = _Sales * _Rate

      RETURN
      _ConvertedMeasure
       

       

      Finally what I am struggling with is finding a way to show the EURO sign when selected. Right now it would still display the USD dollar sign $ for Euros. Difficult trying to format for euro.

       

      Thanks!!