MDX帮助 - 将月份作为值返回

时间:2017-12-21 15:31:00

标签: sharepoint mdx performancepoint

我正在尝试使用MDX在SharePoint中复制Excel公式。我所拥有的挂断在Excel中,我可以将所选月份作为数字引用并在我的公式中使用该数字(即6月为6月,10月为10等)。

有没有办法让我在过滤器中选择一个月的MDX解码,就像我在Excel中那样?

如果可能,还有一种方法可以用它来计算一年中剩下的月数(如果我在过滤器中选择九月,那么公式就知道9月9日,9 - 9 =一年还剩3个月?)

非常感谢你的帮助! 迈克尔

1 个答案:

答案 0 :(得分:0)

您可以使用VBA类型函数从日期中提取月份编号:

e.g。

WITH  MEMBER [Measures].[Full Date] as 'NOW()'
-- The Second Calculated Member is the Day part of the first calculated member.
MEMBER [Measures].[What Day] as 'DAY([Full Date])'
-- The Third Calculated Member is the Month part of the first calculated member.
MEMBER [Measures].[What Month] as 'MONTH([Full Date])'
-- The Fourth Calculated Member is the Year part of the first calculated member.
Member [Measures].[What Year] as 'YEAR([Full Date])'
SELECT
   {[Full Date],[What Day],[What Month],[What Year]} ON COLUMNS
FROM Sales

请参阅此参考:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1555eb27-f277-4f60-87ca-a2c2d6c12917/equivalent-function-in-mdx-for-monthx-as-in-sql?forum=sqlanalysisservices