<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi,</div><div><br></div><div>I want to calculate histogram data for a level over a measure of a cube.I wrote the following MDX:</div><div><br></div><div style="color: rgb(0, 0, 191);">with<br>member [Measures].[Range1] as <br>'Count(Filter([CustomerID].[CustomerID].members, [Measures].[WholeBalance]&lt;10000))'<br>member [Measures].[Range2] as <br>'Count(Filter([CustomerID].[CustomerID].members, [Measures].[WholeBalance]&gt;=10000 and [Measures].[WholeBalance]&lt;100000))'<br>select<br>{[Measures].[Range1],[Measures].[Range2]} on axis(0)<br>from [CustomerBal]<br></div><div><br></div><div>The MDX calculates the result, but my CustomerID level has 2,150,354 members, and as I checked for every calculated member, Mondrian generates a SQL to find the members with the condition in Filter() and then count every found member <span
 style="background-color: rgb(255, 191, 128);">in memory</span> instead of using SQL count function. This results to long execution and bad performance for my reports.</div><div><br></div><div>The generated SQL for [Measures].[range1]:</div><div style="color: rgb(127, 63, 0);">SELECT <span style="background-color: rgb(255, 191, 128);">"COR_CB_CUSTOMERBAL"."MS_CUSTOMERID" </span>AS "c0"<br>FROM "BIDWH"."COR_CB_CUSTOMERBAL" "COR_CB_CUSTOMERBAL"<br>GROUP BY "COR_CB_CUSTOMERBAL"."MS_CUSTOMERID"<br>HAVING (SUM("COR_CB_CUSTOMERBAL"."MR_WHOLEBALANCE") &lt; 10000.0)<br>ORDER BY "COR_CB_CUSTOMERBAL"."MS_CUSTOMERID" ASC</div><div><br></div><div>The generated SQL for [Measures].[range2]:</div><div style="color: rgb(127, 63, 0);">SELECT <span style="background-color: rgb(255, 191, 128);">"COR_CB_CUSTOMERBAL"."MS_CUSTOMERID"</span> AS "c0"<br>FROM "BIDWH"."COR_CB_CUSTOMERBAL" "COR_CB_CUSTOMERBAL"<br>GROUP BY "COR_CB_CUSTOMERBAL"."MS_CUSTOMERID"<br>HAVING
 ((SUM("COR_CB_CUSTOMERBAL"."MR_WHOLEBALANCE") &gt;= 10000.0)<br>AND (SUM("COR_CB_CUSTOMERBAL"."MR_WHOLEBALANCE")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt; 100000.0))<br>ORDER BY "COR_CB_CUSTOMERBAL"."MS_CUSTOMERID" ASC</div><div><br></div><div>But it would be better if generated SQL uses the SQL count function to directly count the members. <br></div><div><br></div><div>So what can I do?<br></div></div></body></html>