Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Aggregate Function on Calculated Member in SCOPE

$
0
0

Hi All,

I've created a set (TAPFilter) based on some events, so I can use this set later in calculations.  Then, I created a calc member (TAP Players), which is equal to the distinct count measure that already exists in the cube.  Then, using the scope statement, I applied a filter to this calc member to null out anything that is not TAPFilter.  The last scope statement is to ensure that the new calculated member is aggregated properly bottom up. 

Unfortunately, it doesn't work.  The 'Aggregate' function ignores the filter and displays the [PlayerDistinctCount] measure.  Furthermore, if I use the SUM function instead of the Aggregate, it works correctly.  However, I cannot use the SUM function, as I am working with the distinct count of users.

Any suggestions would be appreciated!

CREATE 
  SET CURRENTCUBE.[TAPFilter] AS 
    {
      [Event].[Events].[Event].&[122]
     ,[Event].[Events].[Event].&[2483]
    } ;

CREATE 
  MEMBER CURRENTCUBE.[Measures].[TAP Players] AS 
    [Measures].[PlayerDistinctCount]
   ,FORMAT_STRING = "#,#" 
   ,VISIBLE = 1 
   ,SOLVE_ORDER = 0
   ,ASSOCIATED_MEASURE_GROUP = 'Events' ;

SCOPE 
  [Measures].[TAP Players] ;
  SCOPE 
    -
      [TAPFilter];
    this = NULL;
  END SCOPE;

-----Aggregate bottom up
  SCOPE 
    Descendants
    (
      [Event].[Events].[All]
     ,[Event].[Events].[Event Type]
     ,SELF_AND_BEFORE
    );
    this = 
      Sum
      (
        Descendants
        (
          [Event].[Events].CurrentMember
         ,[Event].[Events].[Event]
        )
       ,([Measures].[TAP Players]
      );
  END SCOPE;
END SCOPE;



Thanks, Pasha


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>