我对 MDX 没什么意见。有没有办法通过 MDX 查询从系统/服务器获取当前年份?我没有任何与日期相关的维度或类似的东西。
问候。
创建一个成员并将其定义为 'YEAR(NOW())'
Member [Measures].[Current Year] as 'YEAR(NOW())'
这是一个更完整的示例
-- The First Calculated member is the value of NOW()
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 [Your Cube]