0
我正在使用MDX和Microsoft SQL Server 2008 Analysis Services。我有一个具有以下尺寸的货运立方体:在MDX中,我怎样才能找到每月最后一天的运输量?
* Measures: Quantity
* Time: Year/Month/Day
* Ship Date: Year/Month/Day
* Receipt Date: Year/Month/Day
我想知道每月最后一天的运输量。我怎样才能做到这一点?在SQL中,它会是这样的:
SELECT
A.[Month], SUM(B.[Quantity]) AS [In Transit]
FROM
(SELECT [Month], MAX([Day]) AS [End of Month] FROM [Time] GROUP BY [Month]) A
CROSS JOIN
(SELECT [Quantity], [Ship Date], [Receipt Date] FROM [Shipments]) B
WHERE
B.[Ship Date] <= A.[End of Month]
AND B.[Receipt Date] > A.[End of Month]
GROUP BY
A.[Month]
您的发货日期是完整日期维度(没有日期缺失)?你到目前为止尝试过哪些MDX查询? – michele