Welcome to EMC Consulting Blogs Sign in | Join | Help

Christian Wade's Blog

Currency Conversion in Analysis Services

This article was originally written for Analysis Services 2005, but everything still applies today even for Analysis Services 2012 in Multidimensional mode.

First thing to do: figure out what type of currency conversion you need.  There are 3 types.

  1. MANY-TO-MANY.  This is where the facts are stored in multiple currencies – i.e. amounts for the same measure are in various currencies in the same fact table.  Also, the users might want to report the total amount in different currencies.
  2. MANY-TO-ONE.  The facts are stored in multiple currencies, but this time it is only necessary to ever report the total amount in a single currency – e.g. a corporate currency.
  3. ONE-TO-MANY.   The facts are always stored in one currency only.  However, the users might want to report the total amount in different currencies.

This post focuses on the different options available for One-to-Many.  With One-to-Many, there are 2 options: measure expressions or the currency conversion wizard.

If you create a DSV on top of AdventureWorksDW and include DimTime, FactInternetSales, FactCurrencyRate and DimCurrency, it should look something like this.


The relationship between FactInternetSales and DimCurrency is for the case where your facts are stored in multiple currencies (Many-to-Many and Many-to-One).  To look at One-to-Many, we will delete this relationship.  Also, we will delete the ShipDate and DueDate relationships between FactInternetSales and DimTime, but leave the OrderDate relationship (this post is about currency conversion, not role-playing dimensions!).

We now have the following DSV diagram.



I created a cube on top of this DSV.  Here is a backup of it http://blogs.conchango.com/christianwade/CurrencyConversionBackup.zip  You can download, restore and open it using the VisualStudio using the File > Open > Analysis Services Database menu option.

The only measures in it are Sales Amount (from FactInternetSales) and End Of Day Rate (from FactCurrencyRate).  Sales Amount has a FormatString of “Currency”.  End Of Day Rate has an AggregateFunction property value of “LastNonEmpty”.  LastNonEmpty is a semi-additive measure.  We want it to sum for all dimensions except Date.  For the Date dimension, it will take the last non-empty child.  For example, the exchange rate we would want to see for a week member in a report would not be the sum of the exchange rate on Monday + exchange rate on Tuesday + exchange rate on Wednesday, …  Instead, we just want the most recent exchange rate (maybe exchange rate on Saturday).

The Date dimension is very simple.  The Date attribute, which is the key attribute, has a KeyColumns property of TimeKey (which is the surrogate key of the DimTime table) and a NameColumn of FullDateAlternateKey (what the users see at Date level).

I used the Dimension Wizard to create the Date dimension so that it would be flagged with Type = Time, etc.  This is one of the few cases where having these properties set correctly actually affects cube behaviour.  For example, semi-additive measures and some MDX functions like YTD won't work without Type = Time.

Date Dimension

Here are the mappings in the Dimension Usage tab.  They are pretty straightforward.  There is a many-to-many relationship between Currency and Fact Internet Sales.

Dimension Usage

Here is a screenshot of the Currency dimension.  The main points about the Currency dimension are as follows.

  • The KeyColumns property of the Currency attribute is set to CurrencyKey (which is the surrogate key in for the DimCurrency table in AdventureWorksDW).
  • The NameColumn property of the Currency attribute is set to CurrencyName (which is what we want the users to see).
  • The Type property of the dimension is set to Currency.  The only purpose of this (unlike Type=Time that does affect cube behaviour) is to inform client tools in case they want to display currency dimensions differently to regular dimensions.
  • The Type property of the Currency attribute is set to CurrencyName.  Again, this is just to inform client tools.
  • The IsAggregatable property of the Currency attribute is set to False.  This removes the All level for the attribute.  We would after all not want to sum the values of different currencies.  500 pounds sterling plus 100,000 cruzeiros equals 100,500 of what currency?  Monopoly money?
  • Set the DefaultMember property of the Currency attribute to whatever the Sales Amount values are stored in.  In the case of AdventureWorksDW, it is US Dollars.
  • The attribute relationship between Currency and Currency Alternate Key has its Cardinality property set to One.  This is because, for a particular Currency, there can be only one Currency Alternate Key – i.e. they have a one-to-one relationship.  This improves efficiency in aggregation because the numbers will always be the same (e.g. £500 for “Great Britain Pounds” will always result in £500 for “GBP”).  Analysis Services will therefore not bother figuring out the aggregate values for Currency Alternate Key.  It will simply re-use those of Currency.
  • Set the AttributeHierarchyEnabled property of the Currency Alternate Key attribute to False.  If it is not set, Analysis Services will not allow deployment of the project because of the attribute relationship with Currency and that Currency has IsAggregatable = False.

Currency Dimension

Here is the measure expressions bit.  The Sales Amount measure has the following measure expression: “[Sales Amount] / [End Of Day Rate]”.  The facts are stored in US Dollars and the “pivot currency” is US Dollars.  The pivot currency is the currency the exchange rate values convert from.  The measure expression is a division rather than a multiplication because this is the way the exchange rates are held.  For example, the exchange rate for GBP is roughly 1.5 in the FactCurrencyRate table.  Therefore, to convert $15 from the pivot currency to GBP, 15 / 1.5 gives us 10.  Doing a multiplication would result in £22.50 (obviously wrong).  Note: measure expressions are done at leaf level.

Measure Expression

It is worth going back into the Dimension Usage tab and setting the DirectSlice property of the many-to-many relationship.  Setting it to “([Currency].[Currency].&[100])” means that, when querying Sales Amounts by the base/pivot currency (US Dollars), Analysis Services will just return the value as it appears in the fact table – i.e. without applying the measure expression.  After all, there is no need to convert US Dollars into US Dollars!  If we did not set DirectSlice, we would have to ensure that the FactCurrencyRate table has an exchange rate of 1 for converting US Dollars into US Dollars (and for every single day for which we have data).  Otherwise, Analysis Services would be looking for an End Of Day Rate to divide by, find null and return null.  It should also perform better when querying by USD with DirectSlice populated correctly because it doesn't have to bother with the conversion calculation at all.  So what we want is just a tuple with the default member for every enabled attribute in the outer many-to-many dimension.  Incidentally, this is what the Root(<dimension_expression>) function would return, but we can't use any MDX functions in the DirectSlice property (hence the Functions pane is disabled), so we have to explicitly list each default member in a tuple.


Lastly, we will insert some MDX in the Calculations tab that sets the Locale ID for currencies.  This will avoid displaying 500 pounds sterling as “$500” (goodness gracious!).  For a complete list of the Locale IDs, see http://www.microsoft.com/globaldev/reference/lcid-all.mspx
Language([Currency].[Currency].[United Kingdom Pound]) = 2057;
Language([Currency].[Currency].[Brazilian Real]) = 1046;
Language([Currency].[Currency].[US Dollar]) = 1033;
These assignments are for illustration purposes only.  The main problem with this approach is maintainability.  If we bring in new currencies in the future, we need to modify the MDX script.  The ideal would be to store them in the DimCurrency table, expose them using the ValueColumn property of the Currency attribute, and use that for the assignment.  Some may prefer to go the member property route, but I think this is a good use case for the ValueColumn property.
Language(([Currency].[Currency].Members, [Measures].[Sales Amount])) =
    [Dim Currency].[Currency].CurrentMember.MemberValue;

Locale ID MDX

Let’s build and deploy!  Now let’s browse!

Browse at aggregated level

On the face of it, these numbers seem OK.  29,358,677 is roughly 1.5 times 19,685,311.  But let’s double check.  Copying and pasting into Excel reveals that this is not the case.  There is actually a discrepancy of £784,195!  Why is that?  Well, this is actually the behaviour that we want …

Check numbers in Excel at aggregated level

If you remember, measure expressions are done at leaf level.  This calculation is, as George Spofford would say, “non-commutative”.  Addition/subtraction combined with multiplication/division will result in different numbers depending on whether the multiplication/division is done at leaf level or the aggregated level.  Analysis Services has done the currency conversion at leaf level – i.e. at the day that each transaction actually took place.  This is of course much more accurate.

So let’s test this as well.  Drilling into Date reveals the following.

Browse to leaf level

Copying and pasting the Date-level data into Excel and applying the multiplication reveals that the numbers are indeed calculated correctly at leaf level.

Check leaf-level numbers in Excel

For one-to-many currency conversion, I prefer using measure expressions rather than the currency conversion wizard.  As shown by this post – http://blogs.conchango.com/christianwade/archive/2006/07/25/4256.aspx  – measure expressions are the most performant way of doing this kind of calculation.  The wizard generates MDX that does the calculation at runtime, so it is not quite as performant for large volumes.  Furthermore, virtually all the work we have just gone through to enable measure-expression currency conversion would also have to be done prior to running the wizard (with the exception of the measure expression itself).  Anyway, for completeness, let’s take a look at how the currency conversion wizard does it.


Picking up where we left off, just delete the measure expression and run the wizard.  As I said, pretty much all the other stuff we had to do to enable measure expressions has to be done prior to running the wizard anyway.

From the Cube Structure tab, select Cube > Add Business Intelligence.

Run wizard

Select “Define Currency Conversion” and click Next.

Wizard page 1

Fill in the next page in the wizard as shown here.  Specify which measure group contains the exchange rates.  The pivot currency, as discussed above, is US Dollars.  “1.5 US Dollars per 1 United Kingdom Pound” sounds right, so let’s go with that.

Wizard page 2

Select Sales Amount as the measure(s) we want to convert.

Wizard page 3

Specify One-to-many currency conversion.

Wizard page 4

Now it wants us to specify the “reporting currencies”.  It will actually create another currency dimension called “Reporting Currency”, which will be based on this selection.  I would imagine that most cubes that only need one-to-many currency conversion will have the base Currency dimension purely for the purpose of viewing the values in foreign currencies!  Adding another currency dimension can be a little overkill in my opinion.  I selected United Kingdom Pound and Brazilian Real for my reporting currencies.

Wizard page 5

The last page shows us what changes will be made to the cube/DSV.  Click Finish.

Let’s take a look at what it actually did.  Firstly, we have a new entity in our DSV called Reporting Currency.  It is basically the same as the FactCurrencyRate, but filtered on the pivot currency and the other currencies we selected as reporting currencies.  Interestingly, it is not related to any other entity in the DSV.

Reporting Currency entity in DSV

The wizard also created a dimension called Reporting Currency that is based on the Reporting Currency entity in the DSV.  It is very similar to our Currency dimension.  The Currency attribute has a DefaultMember property of US Dolllars, its IsAggregatable property is set to False, etc., etc.  In fact the only difference of any significance is that it has not set the Cardinality property of the attribute relationship to One.

Reporting Currency dimension

And here is the MDX script it generated.  Note: there is a bug in this script.  If you are using a Date dimension that is called something different to the base dimension name (e.g. Order Date vs. Date), you will have to replace “Scope( Leaves([Date])” with “Scope( Leaves([Order Date])”.

      // <Currency conversion>


            // Currency conversion wizard generated script.      

            // Currency conversion generated on: 24 August 2006 15:36:38

            // by user: Conchango2 

            // Currency conversion type: OneToMany   

            // Selected members to be converted: Sales Amount    

            // Please be aware that any changes that you decide to make to it may be overridden the next time you run the Currency Conversion wizard again. 


            // All currency conversion formulas are calculated for the non pivot currency and at leaf of the time dimension

            Scope ( { Measures.[Sales Amount]} );

                  Scope( Leaves([Date]) ,

                        Except([Reporting Currency].[Currency].[Currency].Members, [Reporting Currency].[Currency].[Currency].[US Dollar]));


                // This section overrides the Pivot Currency values with the Converted value for each selected measures/account members/account type members needing to be converted with Measure rate End Of Day Rate

                // LinkMember is used to reference the currency from the source currency dimension in the rate cube. 

                Scope( { Measures.[Sales Amount]} );

                       This = [Reporting Currency].[Currency].[US Dollar] / (Measures.[End Of Day Rate], LinkMember([Reporting Currency].[Currency].CurrentMember, [Currency].[Currency])) ;

                End Scope;   


                  End Scope; // Leaves of time and non pivot currency  

            End Scope; // Measures


        // End of the currency conversion wizard generated script

      // </Currency conversion>

Having done some (thorough) scoping, the line of code that is of real interest is

This = [Reporting Currency].[Currency].[US Dollar] / (Measures.[End Of Day Rate], LinkMember([Reporting Currency].[Currency].CurrentMember, [Currency].[Currency])) ;

This line is doing the division in a similar way to the measure expression.  However, it is using the LinkMember function to do a runtime link between Currency and Reporting Currency based on the member name.  This is effectively just replacing the Currency dimension with the Reporting Currency dimension for reporting purposes.


As I said, if all you have is a one-to-many currency conversion requirement, I think the measure expressions approach is more elegant. It stores the calculated data on disk rather than calculating at runtime, so it should perform a little better for large volumes (despite the fact that cell assignments in MDX script do perform very well).  Also, there is only one currency dimension (instead of Currency and Reporting Currency).  For many cubes that just require one-to-many currency conversion, this is a simpler model.  Plus a lot of the work you have to do to use the measure expressions approach has to be done anyway in order to run the wizard.  This is in contrast to the Time Analysis wizard, which I think adds great value.  I think the currency conversion wizard adds more value for many-to-many currency conversion.  In this case, you would invariably want the 2 currency dimensions.

Correction: measure expressions do not store the calculations on disk, but are optimized to perform better than MDX script/calculated members (so everything else still applies).


Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



SQL DB Collection ? Blog Archive » Currency Conversion in Analysis Services 2005 said:

January 23, 2007 9:48 AM

phylae said:

I have tried following the instructions left here; however, if a user selects multiple currencies as a "Report Filter" in Excel (or if I choose multiple currencies in a WHERE clause) then I get unexpected results. I have Set IsAggregatable to False, but SSAS still seems to aggregate along the currency dimension when the user chooses some (not all) of the dimension members.

Any ideas??

May 3, 2007 10:57 PM

driskoll said:

"The ideal would be to store them in the FactCurrencyRate table, expose as a measure and use it for the assignment."

I agree, this sounds like the more ideal solution. Any suggestions on how to get this implmented? I have a proper locale ID column on my currency table.

Extremely helpful article btw. The MSDN docs didn't explain how to do any of this stuff.

April 22, 2008 11:58 PM

Piero Astorino said:

I have read the link.  How does it handle translating different accounts at different rates according to accounting rules, the f/x on the cash flow statements, the cumulative translation adjustment on the balance sheet etc…?  A proper translation if the subsidiaries are separate legal entities requires these considerations to be worked into the solution.  

September 19, 2008 1:33 AM

azbest208 said:

Great && helpfull article.

Unfortunately I got an issue which is related with this problem. In case you take as an example currency not UK Pound but i.e. DEM or FRF then drilldowning to years 2002 (and later) are curremcy rates NULL.

Logicaly there should be the last rate (for both average and EndOfDay Currency).

Is there any elegant solution?

August 25, 2009 11:26 AM

Sam Kane said:

Here are this and some other articles on Measure Formatting:

<a href="http://ssas-wiki.com/w/Articles#Measure_Formatting">


March 16, 2011 8:19 PM

malkit said:


March 27, 2011 4:15 AM

CafeF said:

Great Post! It’s very nice to read this info from someone that actually knows what they are talking about.

April 23, 2011 6:56 AM

Ken said:

Good post, however since LastNonEmpty is a semi-additive measure this cannot be done on SQL Server 2008 standard.

April 27, 2011 4:19 PM

Srivathsan said:

I am using Many to Many Currency Conversion and a MeasureExpression (ex RetailAmount * ExchangeRate) . This works gr8 for Measures with Aggregation = Sum.

But I have a Measure with Aggregation = LastNonEmpty. When I apply MeasureExpression on it , deployment Fails . Is there any workaround for it.

August 4, 2011 9:57 PM

Paul Wallington said:

This is a great article and works great for me.

I am however strugling to combine currency conversions with calculated dimensions.

I want to be able to convert Revenue figures using a many-to-one method, but also apply calculated dimensions at the same time as per the following article :-


Can anyone advise ?

February 28, 2012 3:18 PM

Sara Jonson said:

Hi, I am a <a href="http://www.mmfsolutions.com/bullion.php">Daily profit tips</a> and I like to read article or blogs, mainly I read all blogs, it is my habit to collect information where ever I can, it will never waste ,today I caught your nice blog and it is written nicely with good content.....I appreciate it....

October 17, 2013 9:28 AM

Simona said:


I've implemented your solution. But there is an issue. without using the Currency dimension I correctly see the defalut currency (€ in my case).

But when I use the Currency dimension (on the rows or on the columns), I can see ALL the currency except the default one.

Any idea? Thank you

February 7, 2014 12:40 PM

Chris said:

Be careful when choosing measure expressions rather than scoping for fx rate calculations. Measure expressions will not work for aggregation designs (which might become necessary as data grows).

April 3, 2014 4:11 PM

K von Murphny said:

Many thanks for this very helpful tutorial!

About the Language: I've found that the default currency format is the one from the cube default language if it is set. For our European customer, we need the € as the default, and English as the default language.  We decided to set Language = 1036 (French:  100 €) manually for each non-converted currency ; but if we forget one, we cannot tolerate to see $100 or £100 appear. So we we've put English(Irland) as the default cube language, as Ireland use the euro. Most Europeans will want "100 €" instead of the Irish "€ 100", but that's better than a wrong currency.

For converted currencies, putting the MS Locale ID in the database is a must, as advised.

Defining the currency format one by one by code is just painful and error prone.

The other option is to abandon the currency format...

May 13, 2014 9:44 AM

Dee said:

Hello, hope you're well, I read your blog about currency conversion, it was quite interesting, thanks for blogging on that. I have a very unique problem I'm trying to solve and would like your input.

Business Case

Provide currency conversion for olap reporting, the data is stored in GBP, but the business requires a reporting to currency on 57 different currencies and a "budget currency".


The conversion is based on a source currency and currency rate id - this is different from traditional cases where a flat rate is used. My fact table contains (amongst other things), currency rate id, source currency code and  4 measures.

The rates table contains the currency rate id, currency code and the rate. I have tried all that I know using the traditional methods of conversion but to no avail. If you need me to send you some data to play with please let me know.

hope to hear from you soon.

Kind Regards,


August 10, 2014 1:59 PM

Leave a Comment

Powered by Community Server (Personal Edition), by Telligent Systems