我們想要統計「庫存單位」大於0的那些星期。
我已經把它放在了一起,但它不是很有效,它計算了一個物品的所有周數,而不僅僅是庫存> 0的那些物品。嘗試過的一些過濾器,但他們總是導致#ERROR作爲結果MDX用過濾器計數?
WITH
SET [PreviousSixWeeks] AS
Tail
(
Filter
(
[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Week]
,
[Measures].[Inventory Units] > 0
)
,6
)
MEMBER [Measures].[INVWeekCount] AS
DistinctCount(PreviousSixWeeks*[Measures].[Inventory Units]*[Item].[Item Code])
SELECT
{[Measures].[INVWeekCount]} ON COLUMNS
,{[Item].[Item Code].[Item Code]} ON ROWS
FROM
(
SELECT
{[Location].[Location].&[64]} ON COLUMNS
FROM
(
SELECT
{
[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[2].&[8]
,[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[2].&[9]
,[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[3].&[10]
,[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[3].&[11]
,[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[3].&[12]
,[Time].[Yr-Qtr-Per-Wk-Day].[Fiscal Year].&[2016].&[1].&[3].&[13]
} ON COLUMNS
FROM [RFP]
)
);