currency conversion in olap (script mdx)

296 views Asked by At

Task is in terms of currency. in the cube should remain only two dimensions: initial currency and the final. I think it can be done in this way:

SCOPE([Dim Time].[Y-Q-M-D].Members,[Convert Currency].[Member Id].Members,[Source Currency].[Member Id].[All])
//revenue
[Measures].[Value Sum Price]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
[Measures].[Value Sum Price]*[Measures].[Value Currency])
//taxes
[Measures].[Value Sum NDS]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
[Measures].[Value Sum NDS]*[Measures].[Value Currency])
//Discount
[Measures].[Value Sum Discount]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
[Measures].[Value Sum Discount]*[Measures].[Value Currency])
END SCOPE; 

But I have an error:

MdxScript(Sales) (10, 1) Parser: The syntax for '[Measures]' is incorrect. 0 0

Do you know how to fix this?

2

There are 2 answers

3
FrankPl On BEST ANSWER

The syntax error occurs because you need a semicolon at the end of each statement, i. e. after each of the three assignments.

1
whytheq On

I'm agreeing with FankPI. Just a basic search of MSDN (the creators of MDX) takes me here: http://msdn.microsoft.com/en-us/library/ms145989.aspx

This tells me that you are missing a semi-colon infront of the first [Measures]

SCOPE([Dim Time].[Y-Q-M-D].Members,[Convert Currency].[Member Id].Members,[Source Currency].[Member Id].[All])

; //<<here

  //revenue
  [Measures].[Value Sum Price]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
  [Measures].[Value Sum Price]*[Measures].[Value Currency])
  //taxes
  [Measures].[Value Sum NDS]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
  [Measures].[Value Sum NDS]*[Measures].[Value Currency])
  //Discount
  [Measures].[Value Sum Discount]=SUM(Descendants([Source Currency].[Member Id].[AllMembers],,LEAVES),
  [Measures].[Value Sum Discount]*[Measures].[Value Currency])
END SCOPE; 

If you add this required semi-colon what is the new error message?