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])'
member [Measures].[What quarter] as 'Datepart(''q'',now())'
SELECT
{[Full Date],[What Day],[What Month],[What Year],[What quarter]} ON COLUMNS
FROM [adventure works]
MDX函数妙用-获取当前相关日期
最新推荐文章于 2025-07-17 09:41:27 发布
本文介绍了一种使用MDX(多维表达式)从一个完整的日期中拆解出年、月、日及季度的方法,并展示了如何通过创建计算成员来实现这一过程。具体包括:1. 定义了一个名为[FullDate]的计算成员,其值为当前日期;2. 分别创建了[WhatDay]、[WhatMonth]、[WhatYear]和[WhatQuarter]等计算成员,用于提取[FullDate]中的日、月、年和季度信息。
4037

被折叠的 条评论
为什么被折叠?



