I'm using sql server 2008 R2 SP2 CU6. The storage mode for fact is ROLAP and dimensions are MOLAP. Have set EnableRolapDistinctCountOnDataSource as 1 in ini file.
When MDX with distinct measures are fired it does fire SQL with SELECT COUNT(DISTINCT .. but not always.
SELECT non empty except([STORE].[STORE].MEMBERS, {[STORE].[STORE].&[9999],[STORE].[STORE].&[9998]}) on rows, [Distinct Measure] on columns from <CUBE>
does fire distinct count sql
SELECT non empty {[STORE].[STORE].&[9999],[STORE].[STORE].&[9998],[STORE].[STORE].&[9997]} on rows, [Distinct Measure] on columns from <CUBE>
does fire distinct count sql
But
SELECT non empty {<set with more than 150 stores>} on rows, [Distinct Measure] on columns from <CUBE>
doesn't fire distinct count sql, instead it fetches data at Store level and distinct count column level and tries to calculate distinct inside cube. That is lots of data flow from database and ssas and causes performance issue.
I came across this property (undocumented) MaxRolapOrConditions, default is 150 and i tried to increase to 250, it worked out great, but still after 250 stores in the set, it doesn't fire distinct count sql. Increasing MaxRolapOrConditions more than 256 caused SSAS to crash, though the Database (Vertica) can handle any number of OR conditions.
Any solutions? Can this be taken as SSAS bug?
Shom