我有MDX
显示过去4个月内特定广告名称的衡量标准:
WITH
SET [Selected Measures] AS
{
[Measures].[Cost]
,[Measures].[Clicks]
}
SELECT
[Selected Measures] ON COLUMNS
,NonEmpty
(
(
[Ad Name Dim].[Ad Name].[Name].ALLMEMBERS
,
ClosingPeriod
(
[Time Dim].[Time Dim].[Month]
,[Time Dim].[Time Dim].[All Time]
).Lag(3)
:
ClosingPeriod
(
[Time Dim].[Time Dim].[Month]
,[Time Dim].[Time Dim].[All Time]
)
)
) ON ROWS
FROM [CubeName];
我想在SSRS报告中添加另一个可供我使用的字段,该字段将显示特定广告在数据上的第一个日期
像 Min([Time Dim]。[Time Dim]。[Day])。
答案 0 :(得分:0)
这个(未经测试):
With SET [Selected Measures] AS { [Measures].[Cost]
,[Measures].[Clicks] }
SET SetOfMonths as ClosingPeriod([Time Dim].[Time Dim].[Month],
[Time Dim].[Time Dim].[All Time]).Lag(3):ClosingPeriod([Time Dim].[Time Dim].[Month])
SET FirstDay as
HEAD([Time Dim].[Time Dim].[Day], 1)
SELECT [Selected Measures] ON COLUMNS,
nonempty(([Ad Name Dim].[Ad Name].[Name].allmembers,
SetOfMonths, FirstDay,
[Time Dim].[Time Dim].[All Time])) ON ROWS
FROM [CubeName]
答案 1 :(得分:0)
未经测试 - 如果您可以转换为针对AdvWorks多维数据集的脚本,那么对于贡献者来说更容易:
WITH
SET [Selected Measures] AS
{
[Measures].[Cost]
,[Measures].[Clicks]
}
MEMBER [Measures].[MinDate] AS
Head
(
NonEmpty
(
[Time Dim].[Time Dim].[Month] //<<to return minimum month but could be changed to a different level
,(
[Selected Measures]
,[Ad Name Dim].[Ad Name].CurrentMember
)
)
,1
).Item(0).Item(0).Member_Caption
SELECT
{
[Selected Measures]
,[Measures].[MinDate]
} ON COLUMNS
,NonEmpty
(
(
[Ad Name Dim].[Ad Name].[Name].ALLMEMBERS
,
ClosingPeriod
(
[Time Dim].[Time Dim].[Month]
,[Time Dim].[Time Dim].[All Time]
).Lag(3)
:
ClosingPeriod
(
[Time Dim].[Time Dim].[Month]
,[Time Dim].[Time Dim].[All Time]
)
)
) ON ROWS
FROM [CubeName];