X

This site uses cookies and by using the site you are consenting to this. We utilize cookies to optimize our brand’s web presence and website experience. To learn more about cookies, click here to read our privacy statement.

Using Multiple Exchange Rates in SSAS

Recently I had a client ask me to support different exchange rates for different measure groups in their Sales cube.  They wanted to be able to specify a separate exchange rate for budget data, forecast data and sales history data.  With a few simple changes to the exchange rate table in the data warehouse and to the currency conversion MDX generated by the business intelligence wizard, I was able to use a different exchange rate for measures of my choosing.

Before making this enhancement, the currency rate fact table had one column for the exchange rate of the day.  I added two more columns and renamed the original rate column so that we could have a rate for sales history, a rate for budget and a rate for forecast, all for the same date.  I then updated the ETL to populate these rates from the source system.

Currency Rate fact query, old method:

Old exchange rate fact table

Currency Rate fact query, new method:

New exchange rate fact table

I already had currency conversion set up in my cube, by leveraging the business intelligence wizard to generate my initial MDX for currency conversion, and then updating it for any additional measures that were added to the cube needing currency conversion.  In order to support a different rate for different measures, I simply added a new scope for each rate type, and specified the rate fact for measure group in the calculation, and then added the measures I wanted to use with that rate to the scope.

In both script blocks, the “Reporting Currency” dimension is my dimension of currencies available for conversion, and which have rates in my exchange rate fact table.  All my facts go into the cube in USD, hence the use of “Except” in the script, to avoid looking for an exchange rate to convert the fact when the user selects “USD” from the Reporting Currency dimension.

Business Intelligence Wizard Generated Script

Calculations table, script view, old method:

Old currency conversion MDX

Modified Business Intelligence Wizard script that can accommodate any measure:

Calculations table, script view, new method:

New currency conversion MDX

By simply adding a couple additional scopes, changing the name of exchange rate fact used in the conversion in each scope, and placing the relevant measures into the appropriate scope, I was able to use a different rate for different measures.

When my customer first came to me with this request, I had no idea it would be end up being this easy.  The most work was to change the ETL to populate 3 columns in my exchange rate table instead of 1.  Performance was not affected and this logic is infinitely flexible.  Another implementation for this technique might be unit of measure conversion.

At the close of the project, the customer was very happy to be able to use different rates for different measures and it hardly took any effort at all! Thanks for reading.