MDX筛选器和日期范围问题

时间:2018-08-09 22:18:18

标签: mdx mdx-query

尝试完成以下任务:

  • 有多少客户从特定产品中购买了任何给定产品 日期范围
  • 在任何给定的条件下,上述客户的总销售额是多少 日期范围

当前查询: 下面的查询提供了我想要的信息:

    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]

问题

当我尝试将日期更改为日期范围时(如下所示的代码belas,我收到错误消息。查询(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的新手,所以有人可以帮我弄清楚我在做什么错吗?谢谢

1 个答案:

答案 0 :(得分:0)

对于其他有类似问题的人-您需要汇总该字段。 How to query Date field in MDX with and without aggregate group