IIF() 函数在单个 MDX 查询中多次使用时无法正常工作

IIF() function not working properly while using multiple times in single MDX query

我需要使用单个 MDX 查询获取基于两个条件的聚合值

我有以下数据

我在下面的查询中使用 IIF() 函数创建了两个计算函数

WITH
         MEMBER [Measures].[Expression1] AS IIF([EMPLOYEE].[TITLE].CURRENTMEMBER.MEMBERVALUE  = "SALES REPRESENTATIVE",[Reseller Order Count],0)
         MEMBER [Measures].[Expression2] AS IIF([EMPLOYEE].[TITLE].CURRENTMEMBER.MEMBERVALUE  = "SALES REPRESENTATIVE",0,[Reseller Order Count])    SELECT{
        [Measures].[Expression1],
        [Measures].[Expression2]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING 

输出必须是 3693 和 103 但返回如下

查询中是否需要做任何更改?

任何人都可以指导我获得正确的结果吗?

您的想法是正确的,但需要跨员工头衔执行此计算:


WITH
  MEMBER [Measures].[Expression1] AS 
   SUM(
     [EMPLOYEE].[TITLE].[TITLE].MEMBERS,
     IIF([EMPLOYEE].[TITLE].CURRENTMEMBER IS [EMPLOYEE].[TITLE].[SALES REPRESENTATIVE],[Reseller Order Count],Null)
   )
  MEMBER [Measures].[Expression2] AS 
   SUM(
      [EMPLOYEE].[TITLE].[TITLE].MEMBERS,
      IIF([EMPLOYEE].[TITLE].CURRENTMEMBER IS [EMPLOYEE].[TITLE].[SALES REPRESENTATIVE],Null,[Reseller Order Count])    
    )
SELECT{
        [Measures].[Expression1],
        [Measures].[Expression2]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING