<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Lucida Sans";
        panose-1:2 11 6 4 2 2 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Hi Julian,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Could you please check that fix:<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>http://jira.pentaho.com/browse/MONDRIAN-682<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Sergey<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Julian Hyde
[mailto:jhyde@pentaho.com] <br>
<b>Sent:</b> Friday, January 22, 2010 9:31 AM<br>
<b>To:</b> 'Sergey Mazin'; 'Mondrian developer mailing list'<br>
<b>Subject:</b> RE: VisualTotals + Distinct-count measure gives wrong results<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Sans";
color:navy'>I'd put a breakpoint in the expression inside the visual totals
function. It should be aggregate( &lt; set of members &gt;).</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Sans";
color:navy'>Distinct-count measures are very difficult to aggregate. You have
to go back to the underlying database. We aggregate distinct-count measures
correctly in other places (e.g. if you create a compound slicer) but it's
tricky.</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

</div>

<blockquote style='border:none;border-left:solid navy 1.5pt;padding:0in 0in 0in 4.0pt;
margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Sergey Mazin [mailto:sergey.mazin@skype.net]
<br>
<b>Sent:</b> Thursday, January 21, 2010 8:17 AM<br>
<b>To:</b> 'Mondrian developer mailing list'<br>
<b>Cc:</b> jhyde@pentaho.com<br>
<b>Subject:</b> VisualTotals + Distinct-count measure gives wrong results</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal>Hi Julian,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><a href="http://jira.pentaho.com/browse/MONDRIAN-682">http://jira.pentaho.com/browse/MONDRIAN-682</a><o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>[Measures].[Number of Employees] - is distinct count
measure. <br>
<br>
Example: <br>
<br>
WITH SET [XL_Row_Dim_0] AS <br>
'VisualTotals(Distinct(Hierarchize({ <br>
Ascendants([Store].[All Stores].[USA].[OR]), <br>
Descendants([Store].[All Stores].[USA].[OR]), <br>
Ascendants([Store].[All Stores].[USA].[CA]), <br>
Descendants([Store].[All Stores].[USA].[CA])})))' <br>
SELECT NON EMPTY Hierarchize(Intersect({DrilldownLevel({ <br>
[Store].[All Stores] <br>
})}, [XL_Row_Dim_0])) ON COLUMNS <br>
FROM [HR] WHERE ([Measures].[Number of Employees]) <br>
<br>
Query should return: <br>
<br>
Axis #0: <br>
{[Measures].[Number of Employees]} <br>
Axis #1: <br>
{[Store].[All Stores]} <br>
{[Store].[All Stores].[USA]} <br>
Row #0: 329 <br>
Row #0: 329 <br>
<br>
But returns empty set. <br>
<br>
The same query with NOT distinct measure works.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>In distinct query cells are not being evaluated properly and
no queries is sent to database.<o:p></o:p></p>

<p class=MsoNormal>Could you please advise what is the best place to start
investigating.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Best regards,<o:p></o:p></p>

<p class=MsoNormal>Sergey<o:p></o:p></p>

</blockquote>

</div>

</body>

</html>