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

Issue while counting members in result set

$
0
0

Hi,

I am into an interesting issue. I have a dimension called Product with hierarchy Product as Rolodex1->Rolodex2->Rolodex3->Product ID.

I am trying to create a calculated measure [Product Count] to count all the "Product ID" (lowest level) under selection.

My measure looks like:

MEMBER [Measures].[Product Count] AS                                         
    COUNT(
   FILTER( EXISTING [Product].[Product].[Product ID].MEMBERS, NOT ISEMPTY( [Measures].[Distinct Product Count] ) ))

The measure works when I select 2 members from same level and combine together and put in where condition. For eg it works on following query:

with

MEMBER [Product].[Product].[All Products].[Aggregation] AS ' AGGREGATE( { [Product].[Product].[Rolodex1].&[44], 
[Product].[Product].[Rolodex1].&[45]}) '

       

 SELECT { [Measures].[Product Count] } ON COLUMNS ,   

{[Paid Date].[Paid Date].[Paid Quarters].&[2016 - Q2],[Paid Date].[Paid Date].[Paid Quarters].&[2016 - Q3]  } ON ROWS     

FROM [Cost and Utilization]    

WHERE ( [Product].[Product].[All Products].[Aggregation] )  

But it doesn't work with the following query when 2 members from different levels are selected and combined together:

with       

MEMBER [Product].[Product].[All Products].[Aggregation1] AS ' AGGREGATE( GENERATE( FILTER( { [Product].[Product].[Rolodex1].&[44], 
[Product].[Product].[Rolodex2].&[4505] }, NOT ISEMPTY( [Product].[Product].CURRENTMEMBER )), 
HEAD( HIERARCHIZE( INTERSECT( { [Product].[Product].[Rolodex1].&[44], [Product].[Product].[Rolodex2].&[4505] }, 
ASCENDANTS( [Product].[Product].CURRENTMEMBER )))))) ' 

SELECT { [Measures].[Product Count] } ON COLUMNS ,   

{[Paid Date].[Paid Date].[Paid Quarters].&[2016 - Q2],[Paid Date].[Paid Date].[Paid Quarters].&[2016 - Q3]  } ON ROWS     

FROM [MyCube]    

WHERE ( [Product].[Product].[All Products].[Aggregation1] ) 

The calculated members generated here [Product].[Product].[All Products].[Aggregation1] is the query generated by Proclarity when I select 2 members from different levels and combine together.

Please help. Has anybody encountered this issue before?

Thank you in advance,

Anish



Anish Tuladhar - Do not forget to mark as answer, only if helpful.:)



Viewing all articles
Browse latest Browse all 14337

Trending Articles



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