如何使用MDX查询获取当前年份? [英] How to Get Current Year with MDX Query?
本文介绍了如何使用MDX查询获取当前年份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对MDX没什么了解. 有什么方法可以通过MDX查询从系统/服务器获取当前年份? 我没有与日期或类似内容有关的任何维度.
I have little thing about MDX. Is there any way to get current year from the system/server with MDX query? I didn't have any dimension related to date or something like that.
致谢.
推荐答案
创建一个成员并将其定义为'YEAR(NOW())'
Create a member and define it as '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]
这篇关于如何使用MDX查询获取当前年份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文