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
RobRayborn
Helper III
Helper III

Currency Conversion

I have a fact table of Sales from three facilities. Two work in Euro and one in GBP.   I have a full Date table with conversion for EURO, GBP and USD. This works, line by line, but the total isn't correct. It appears to go askew whenever the Conversion rate changes in the Dates table.  //note, we use on conversion rate per month.//

 

I'm using a LOOKUPVALUE measure to convert all Euro to GBP:  //fyi GBP conversion = 1//

Daily Sales GBP = SUMX('Daily Sales','Daily Sales'[LC_AMOUNT]/

            LOOKUPVALUE('Currency Rates'[Exchange Rate],
            'Currency Rates'[Date], 'Daily Sales'[ACTION_DATE],
            'Currency Rates'[Foreign Currency], 'Daily Sales'[CURRENCY]))
 
I then us the LOOKUPVALUE measure again to convert the now all GBP values to whatever I decide to choose on my "Ticker".
Current Date = MAX(Dates[Date] )
Currency Selected = SELECTEDVALUE( Currency_Format[Ticker],"GBP")
 
Converted Sales =
VAR _Date = [Current Date]
VAR _CurrencySelected = [Currency Selected]
VAR _Sales = [Daily Sales GBP]
VAR _Rate =
LOOKUPVALUE(
'Currency Rates'[Exchange Rate],
'Currency Rates'[Foreign Currency], _CurrencySelected,
'Currency Rates'[Date],_Date)

VAR _ConvertedMeasure = _Sales*_Rate

RETURN
_ConvertedMeasure
 
4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @RobRayborn 

 

Can you provide a simple PBIX file for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. 

 

Best Regards,

Community Support Team _Charlotte

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

I was able to determine that the DAX measure I am using is working as expected. The problem ended up being a rounding issue. The total Sales amount or [Daily Sales GBP] is a SUMX measure that gets rounded due to converting it to a Whole Number type, however once it takes into effect the Currency Conversion (at each row amount) the rounding for the converted amount is no longer rounded. at that point converting it to a Whole number re-rounds the amount and increased the overall annual amount by about 10K.  
I ended up going backwards and doing my GBP and EURO conversion amounts on Power Query side.

You haven't really provided enough info for me to advise you completely, but I suggest a different approach. You should always Sumx over the smallest possible table

 

SUMX(CALENDAR,

  CALCULATE(SUM(Sales[Value]))*calendar[conversion column])

 

this assumes one row per date and 3 different conversion columns. Above is for one. 
you could expand for 3 conversion columns with a calculate to filter sales for each currency to convert. It's a bit hard for me to say without seeing it. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

I was able to determine that the DAX measure I am using is working as expected. The problem ended up being a rounding issue. The total Sales amount or [Daily Sales GBP] is a SUMX measure that gets rounded due to converting it to a Whole Number type, however once it takes into effect the Currency Conversion (at each row amount) the rounding for the converted amount is no longer rounded. at that point converting it to a Whole number re-rounds the amount and increased the overall annual amount by about 10K.  
I ended up going backwards and doing my GBP and EURO conversion amounts on Power Query side.

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.

Top Solution Authors