olap中的货币转换(脚本mdx)

时间:2014-11-20 21:45:34

标签: scope ssas mdx olap measure

任务就货币而言。在立方体中应该只保留两个维度:初始货币和最终货币。 我认为可以这样做:

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; 

但我有一个错误:

  

MdxScript(Sales)(10,1)Parser:'[Measures]'的语法不正确。 0 0

你知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

发生语法错误是因为您需要在每个语句的末尾加一个分号,即。即在三项任务中的每一项之后。

答案 1 :(得分:0)

我同意FankPI。只需MSDNMDX的创建者)的基本搜索,就可以将我带到这里: http://msdn.microsoft.com/en-us/library/ms145989.aspx

这告诉我你错过了第一个[测量]

前面的分号
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; 

如果你添加了这个必需的分号,那么新的错误信息是什么?