SELECT
[Measures].[BudgetAmount] ON COLUMNS,
NON EMPTY [Date].[Calendar].[Month].MEMBERS.Properties("YYYYMM")
--DIMENSION PROPERTIES [Date].[Calendar].[YYYYMM]
ON ROWS
FROM [WH_Cube]
如何直接在查询结果中显示属性?
答案 0 :(得分:1)
您需要将属性定义为度量:
With Member [Measures].[YYYYMM] as [Date].[Calendar].CurrentMember.Name
或
With Member [Measures].[YYYYMM] as [Date].[Calendar].CurrentMember.Properties("Some Custom Property")
答案 1 :(得分:1)
免责声明:这不是很好(理解)+不是你想要的格式 - 我猜你想让日期显示为“2014年9月”?
WITH
MEMBER [Measures].[DateValueX] as
VBA!cstr(
VBA!YEAR(
VBA!cdate(format(
VBA!cdate(
[Date].[Calendar].[Month].CURRENTMEMBER.member_value),
"dd MMMM yyyy"
)
)
)
)
+
VBA!cstr(
VBA!MONTH(
VBA!cdate(format(
VBA!cdate(
[Date].[Calendar].[Month].CURRENTMEMBER.member_value),
"dd MMMM yyyy"
)
)
)
)
SELECT
{
[Measures].[DateValueX],
[Measures].[BudgetAmount]
}
ON COLUMNS,
NON EMPTY
DESCENDANTS(
[Date].[Calendar].[Month].[201409], //<<you might need to amend [201409] to your cube
[Date].[Calendar].[Calendar Day] //you might need to amend [Calendar Day] to your cube
)
ON ROWS
FROM [WH_Cube]
虽然如果您只想要月份的密钥,那么在“2014年9月25日”之后的日期旁边会显示为“201409”,那么在我们的多维数据集中相对容易:
WITH MEMBER [Measures].[DateValueY] as
[Date].[Calendar].CURRENTMEMBER.Parent.Properties('key0', TYPED)
SELECT
{
[Measures].[DateValueY],
[Measures].[BudgetAmount]
}
ON COLUMNS,
NON EMPTY
DESCENDANTS(
[Date].[Calendar].[Month].[201409], //<<you might need to amend [201409] to your cube
[Date].[Calendar].[Calendar Day] //you might need to amend [Calendar Day] to your cube
)
ON ROWS
FROM [WH_Cube]