<br>Thanks John and Julian.&nbsp; We had considered Julian&#39;s option (1), but it is undesirable because we still want to be able to join to the full set of dimensions in the cube.&nbsp; I spent some time thinking about the MDX for option (2) but couldn&#39;t come up with concrete MDX that worked for our purpose.
<br><br>I hadn&#39;t though about using Measure Expressions--that does seem promising.&nbsp; I tried some quick tests against Oracle and it appears to perform pretty well.&nbsp; <br><br><div><span class="gmail_quote">On 7/18/07, <b class="gmail_sendername">
John V. Sichi</b> &lt;<a href="mailto:jsichi@gmail.com">jsichi@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Oops, my SQL/XML below is slightly inconsistent with itself and<br>FoodMart, but hopefully the idea is clear.<br><br>JVS<br><br>John V. Sichi wrote:<br>&gt; <a href="mailto:julianhyde@speakeasy.net">julianhyde@speakeasy.net
</a> wrote:<br>&gt;&gt; 3. As a future feature, we could extend the catalog.xml syntax to<br>&gt;&gt; allow measures to be defined in tables other than the fact table.<br>&gt;&gt; This is not trivial, because if they are in a different table, you
<br>&gt;&gt; need to specify a join path so mondrian would know how to get to the<br>&gt;&gt; column. I&#39;ve been thinking about separating the relational model<br>&gt;&gt; (which specifies tables, SQL expressions, and join paths) from the
<br>&gt;&gt; dimensional model (which defines cubes and dimensions) within the<br>&gt;&gt; catalog.xml file, and that would provide that metadata. There are a<br>&gt;&gt; bunch of good reasons to do that separation, and this is one more.
<br>&gt;<br>&gt; If your DBMS supports it (efficiently), you can define a measure on a<br>&gt; correlated subquery which looks up a value from a dimension table<br>&gt; (regardless of whether the dimension table is actually known as a
<br>&gt; dimension to Mondrian).&nbsp;&nbsp;The segment load measure computation SQL comes<br>&gt; out &quot;interesting&quot;:<br>&gt;<br>&gt; select<br>&gt;&nbsp;&nbsp; warehouse_id,<br>&gt;&nbsp;&nbsp; max((select sqft from store_dim s where w.store_id=s.store_id
))<br>&gt; from warehouse_fact w<br>&gt; group by warehouse_id;<br>&gt;<br>&gt; &lt;Cube name=&quot;Warehouse&quot;&gt;<br>&gt;&nbsp;&nbsp; &lt;Table name=&quot;inventory_fact_1997&quot; alias=&quot;w&quot;/&gt;<br>&gt;&nbsp;&nbsp; &lt;Measure name=&quot;Max Store Sqftage&quot; aggregator=&quot;max&quot;&gt;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;MeasureExpression&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;SQL dialect=&quot;luciddb&quot;&gt;<br>&gt; (select sqft from store_dim s where w.store_id=s.store_id)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/SQL&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/MeasureExpression&gt;
<br>&gt;&nbsp;&nbsp; &lt;/Measure&gt;<br>&gt;&nbsp;&nbsp; ...<br>&gt;<br>&gt; For max, it even makes sense in this example, though sum wouldn&#39;t due to<br>&gt; multi-counting all the fact rows with the same warehouse_id.&nbsp;&nbsp;Seems like<br>&gt; granularity is the other hard part besides expressing join paths.
<br>&gt;<br>&gt; Or if you trust your DBMS&#39;s optimizer to eliminate unused joins, you can<br>&gt; just create a join view and use that as your fact &quot;table&quot;.<br>&gt;<br>&gt; Of course, having Mondrian know how to generate optimal SQL without
<br>&gt; relying on any DBMS smarts would be ideal.<br>&gt;<br>&gt; JVS<br>&gt;<br><br>_______________________________________________<br>Mondrian mailing list<br><a href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org
</a><br><a href="http://lists.pentaho.org/mailman/listinfo/mondrian">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br></blockquote></div><br>