<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:0 0 0 0 0 0 0 0 0 0;}
 /* 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;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
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;}
 /* List Definitions */
 @list l0
        {mso-list-id:1711495093;
        mso-list-type:hybrid;
        mso-list-template-ids:-134161244 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1
        {mso-list-id:2057194430;
        mso-list-type:hybrid;
        mso-list-template-ids:-511510078 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</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>As it turned out there are 3 problems with VisualTotals at
the moment:<o:p></o:p></p>

<p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>RolapAggregationManager.makeCompoundGroup method doesn&#8217;t
check VisualTotalMembers for constraints. I think I have a fix for that.<o:p></o:p></p>

<p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>DisplayInfo for VisualTotalMembers is sometimes 0. In
Excel it means that it doesn&#8217;t allow to drilldown to next level (Excel
thinks there are no any children for that level). I think I will have a fix for
that also when issue #3 is fixed.<o:p></o:p></p>

<p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo2'><![if !supportLists]><span
style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]>VisualTotals don&#8217;t check constraints of children
of their children.<o:p></o:p></p>

<p class=MsoNormal>Let&#8217;s say we have query:<o:p></o:p></p>

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

<p class=MsoNormal>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])<o:p></o:p></p>

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

<p class=MsoNormal>It should return:<o:p></o:p></p>

<p class=MsoNormal>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<o:p></o:p></p>

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

<p class=MsoNormal>But it returns:<o:p></o:p></p>

<p class=MsoNormal>Axis #0: <br>
{[Measures].[Number of Employees]} <br>
Axis #1: <br>
{[Store].[All Stores]} <br>
{[Store].[All Stores].[USA]} <br>
Row #0: 616<br>
Row #0: 329<o:p></o:p></p>

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

<p class=MsoNormal>SQL queries look like:<o:p></o:p></p>

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

<p class=MsoNormal>For {[Store].[All Stores].[USA]}<o:p></o:p></p>

<p class=MsoNormal>7438 [http-8080-1] DEBUG mondrian.sql&nbsp; - 21:
Segment.load: executing sql [select
&quot;time_by_day&quot;.&quot;the_year&quot; as &quot;c0&quot;, count(distinct
&quot;salary&quot;.&quot;employee_id&quot;) as &quot;m0&quot; from
&quot;time_by_day&quot; as &quot;time_by_day&quot;, &quot;salary&quot; as
&quot;salary&quot;, &quot;store&quot; as &quot;store&quot;,
&quot;employee&quot; as &quot;employee&quot; where
&quot;salary&quot;.&quot;pay_date&quot; =
&quot;time_by_day&quot;.&quot;the_date&quot; and
&quot;time_by_day&quot;.&quot;the_year&quot; = 1997 and
&quot;salary&quot;.&quot;employee_id&quot; =
&quot;employee&quot;.&quot;employee_id&quot; and
&quot;employee&quot;.&quot;store_id&quot; =
&quot;store&quot;.&quot;store_id&quot; and
&quot;store&quot;.&quot;store_state&quot; in ('CA', 'OR') group by &quot;time_by_day&quot;.&quot;the_year&quot;]<o:p></o:p></p>

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

<p class=MsoNormal>For {[Store].[All Stores]}<o:p></o:p></p>

<p class=MsoNormal>7453 [http-8080-1] DEBUG mondrian.sql&nbsp; - 22:
Segment.load: executing sql [select
&quot;time_by_day&quot;.&quot;the_year&quot; as &quot;c0&quot;, count(distinct
&quot;salary&quot;.&quot;employee_id&quot;) as &quot;m0&quot; from
&quot;time_by_day&quot; as &quot;time_by_day&quot;, &quot;salary&quot; as
&quot;salary&quot;, &quot;store&quot; as &quot;store&quot;,
&quot;employee&quot; as &quot;employee&quot; where
&quot;salary&quot;.&quot;pay_date&quot; =
&quot;time_by_day&quot;.&quot;the_date&quot; and
&quot;time_by_day&quot;.&quot;the_year&quot; = 1997 and
&quot;salary&quot;.&quot;employee_id&quot; = &quot;employee&quot;.&quot;employee_id&quot;
and &quot;employee&quot;.&quot;store_id&quot; =
&quot;store&quot;.&quot;store_id&quot; and
&quot;store&quot;.&quot;store_country&quot; = 'USA' group by
&quot;time_by_day&quot;.&quot;the_year&quot;]<o:p></o:p></p>

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

<p class=MsoNormal>For {[Store].[All Stores]} level it doesn&#8217;t add {[Store].[All
Stores].[USA]} constraints.<o:p></o:p></p>

<p class=MsoNormal>It is very important for as to get it fixed, we are using
Excel 2007 as main tool to access cubes and it sends queries in that format.<o:p></o:p></p>

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

<p class=MsoNormal>Regards,<o:p></o:p></p>

<p class=MsoNormal>Sergey Mazin<o:p></o:p></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","serif";
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","serif";
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>