我正在尝试编写一个mdx,它将在我的Fact表中销售最后2个产品,但不是这样,我总是在我的Dim表中销售最新的2个产品。我用谷歌搜索了它,但是无法获得正确的mdx,所以我可以在我的事实中检索最后的记录。到目前为止,我有:
WITH MEMBER [last] as
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).item(
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).count-1).name
MEMBER [previous] as
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).item(
FILTER([DIM_PRODUCT].[PRODUCT_ID].[PRODUCT_ID].MEMBERS,[Measures].[Row Count]).count-2).name
SELECT {[last],[previous]} on COLUMNS
FROM [Cube]
where [DIM_WAREHOUSE].[WAREHOUSE_ID].&[2]
任何帮助都将受到高度赞赏。谢谢!