<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" 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"><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18865">
<STYLE>@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 56.7pt 42.5pt 56.7pt 85.05pt; }
P.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
LI.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
DIV.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        FONT-FAMILY: "Calibri","sans-serif"; COLOR: windowtext; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
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><SPAN class=689442807-22012010><FONT color=#000080 size=2 
face="Lucida Sans">I'd put a breakpoint in the expression inside the visual 
totals function. It should be aggregate( &lt; set of members 
&gt;).</FONT></SPAN></DIV>
<DIV><SPAN class=689442807-22012010><FONT color=#000080 size=2 
face="Lucida Sans"></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=689442807-22012010><FONT color=#000080 size=2 
face="Lucida Sans">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.</FONT></SPAN></DIV><BR>
<BLOCKQUOTE 
style="BORDER-LEFT: #000080 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px" 
dir=ltr>
  <DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
  <HR tabIndex=-1>
  <FONT size=2 face=Tahoma><B>From:</B> 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<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV class=Section1>
  <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></DIV></BLOCKQUOTE></BODY></HTML>