MDX获取产品维度的当前价格登录ID
我有桌子:MDX获取产品维度的当前价格登录ID,mdx,Mdx,我有桌子: Table Products ( ProductID , ProductName,..) --Dimemsion Table PriceLog (PriceLogID, Price, ApplyDate,...) Log the price of product at the event time. - Dimemsion Table Sale (SaleID, ProductID, PriceLogID,...) --Measure 现在我想为报表创建一个MDX查询,如下所示:
Table Products ( ProductID , ProductName,..) --Dimemsion
Table PriceLog (PriceLogID, Price, ApplyDate,...) Log the price of product at the event time. - Dimemsion
Table Sale (SaleID, ProductID, PriceLogID,...) --Measure
现在我想为报表创建一个MDX查询,如下所示:
ProductID, ProductName, PriceLogID, CountProductSold
1 Tivi ,10 ,20
1 Tivi ,11 ,23
2 Phone ,10 ,55
2 Phone ,12 ,10
但我的问题是get PriceLogID and CountProductSald,系统会给我一个内存不足错误,因为我有10000多个PriceLogID
这是我的问题
WITH
MEMBER [Measures].[COUNTProductSold] AS
Count(Exists([Measures].[Sale],[Products].[ProductID].[ProductID]))
SELECT
[Measures].[COUNTProductSold] ON COLUMNS
,
[Products].[ProductID].[ProductID]*
[Products].[ProductID].[Product Name]*
[PriceLog].[PriceLogID].[PriceLogID] ON ROWS
FROM [my cube];
错误:
Exception of type 'System.OutOfMemoryException' was thrown.
下面这些对你有用吗
WITH
MEMBER [Measures].[COUNTProductSold] AS
Count(
NonEmpty
(
[Products].[ProductID].[ProductID],
[Measures].[Sale]
)
)
SELECT
[Measures].[COUNTProductSold] ON COLUMNS,
[Products].[ProductID].[ProductID]* [Products].[ProductID].[Product Name]* [PriceLog].[PriceLogID].[PriceLogID] ON ROWS
FROM [my cube];
我找到了解决方案,因为measurepricelog有超过10000条记录,在计算时,mdx将为每个productID计算10000次。
解决方案是使用带有子查询的非空函数。请添加导致错误的
mdx
脚本。我只是添加了mdx脚本,为了其他人的利益,也共享解决方案。