试图完成以下任务:
- 在任何给定日期范围内有多少客户购买了特定产品
- 在任何给定日期范围内,上述客户的总销售额是多少
当前查询:我下面的查询给了我我想要的东西:
WITH SET Customer_CurrentPeriod as
FILTER (
[CUSTOMER MASTER].[Cust#].children ,
(
[Calendar].[Date].&[20180507]
, [Item Master].[Sub Group Number].&[100]
, [Measures].[Ext Price]
) > 0
)
member Sales_CurrentPeriod as
sum (
([Customer_CurrentPeriod] , [Calendar].[Date].&[20180507])
, [Measures].[Ext Price]
)
member Sales_Sum_CurentPeriod_Count as [Customer_CurrentPeriod].Count
SELECT
{Sales_CurrentPeriod , Sales_Sum_CurentPeriod_Count} ON COLUMNS
from [SalesDatabase]
问题
当我尝试将日期更改为日期范围时(代码如下所示,我收到错误消息。查询 (4, 6) GreaterThan 函数需要字符串或数字表达式作为 1 参数。使用了元组集表达式。
WITH SET Customer_CurrentPeriod as
FILTER (
[CUSTOMER MASTER].[Cust#].children ,
(
{[Calendar].[Date].&[20180507]:[Calendar].[Date].&[20180507]}
, [Item Master].[Sub Group Number].&[100]
, [Measures].[Ext Price]
) > 0
)
member Sales_CurrentPeriod as
sum (
([Customer_CurrentPeriod] , {[Calendar].[Date].&[20180507]:[Calendar].[Date].&[20180507]})
, [Measures].[Ext Price]
)
member Sales_Sum_CurentPeriod_Count as [Customer_CurrentPeriod].Count
SELECT
{Sales_CurrentPeriod , Sales_Sum_CurentPeriod_Count} ON COLUMNS
from [SalesDatabase]
我显然是 MDX 的新手,所以任何人都可以帮助找出我做错了什么吗?谢谢