<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tim laqua dot com &#187; subcube</title>
	<atom:link href="http://timlaqua.com/tag/subcube/feed/" rel="self" type="application/rss+xml" />
	<link>http://timlaqua.com</link>
	<description>Thoughts and Code from Tim Laqua</description>
	<lastBuildDate>Fri, 03 Feb 2012 23:12:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Wierd Slice &#8211; Revenue for the Most Recent Hour in the Cube Across the Last 14 Days Sliced by Week</title>
		<link>http://timlaqua.com/2009/02/wierd-slice-revenue-for-the-most-recent-hour-in-the-cube-across-the-last-seven-days/</link>
		<comments>http://timlaqua.com/2009/02/wierd-slice-revenue-for-the-most-recent-hour-in-the-cube-across-the-last-seven-days/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:12:35 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[calculated measure]]></category>
		<category><![CDATA[calculated member]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[mdx]]></category>
		<category><![CDATA[recent hour]]></category>
		<category><![CDATA[ssas]]></category>
		<category><![CDATA[subcube]]></category>
		<category><![CDATA[tail]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=64</guid>
		<description><![CDATA[Well - there's two parts to this - one is to figure out the most recent hour in the cube that has data. Let's face it, it finishes as soon as it can - but that time may vary now and then. Then, for this particular report, we wanted to see the last seven days [...]]]></description>
			<content:encoded><![CDATA[<p>Well - there's two parts to this - one is to figure out the most recent hour in the cube that has data.  Let's face it, it finishes as soon as it can - but that time may vary now and then.  Then, for this particular report, we wanted to see the last seven days on one series and the previous seven days on another series.  To do this, we just slice by two calculated measures.  But this creates an odd dateset where the This Week column will have no data for the "Date Time" columns that actually belong to the Previous Week.</p>
<p>This isn't really a problem as in SSRS, you can simply define the Category Group for the Series in your chart (ya, I didn't mention that yet - this is all for a chart) as DatePart("w", Fields!DateTime) - which will group everything by the number of the given weekday and then you can just have your "This Week" and "Prevoius Week" series.</p>

<div class="wp_syntax"><div class="code"><pre class="mdx" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">WITH</span> 
  <span style="color: #0000FF; font-weight: bold;">MEMBER</span> <span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[This Week]</span> <span style="color: #0000FF; font-weight: bold;">AS</span> 
    <span style="color: #CC00FF;">Aggregate</span>
    <span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span><span style="color: #66cc66;">:</span><span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span>.<span style="color: #AF0000;">Lag</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #003300; font-weight: bold;">&#41;</span>
     <span style="color: #66cc66;">,</span><span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[Revenue]</span><span style="color: #003300; font-weight: bold;">&#41;</span>
&nbsp;
  <span style="color: #0000FF; font-weight: bold;">MEMBER</span> <span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[Previous Week]</span> <span style="color: #0000FF; font-weight: bold;">AS</span> 
     <span style="color: #CC00FF;">Aggregate</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span>.<span style="color: #AF0000;">Lag</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #003300; font-weight: bold;">&#41;</span>
     <span style="color: #66cc66;">:</span>
     <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span>.<span style="color: #AF0000;">Lag</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #cc66cc;">13</span><span style="color: #003300; font-weight: bold;">&#41;</span>
     <span style="color: #66cc66;">,</span><span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[Revenue]</span><span style="color: #003300; font-weight: bold;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">SELECT</span> 
  <span style="color: #0000FF; font-weight: bold;">NON</span> <span style="color: #0000FF; font-weight: bold;">EMPTY</span> 
    <span style="color: #003300; font-weight: bold;">&#123;</span><span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[Previous Week]</span><span style="color: #66cc66;">,</span> <span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[This Week]</span><span style="color: #003300; font-weight: bold;">&#125;</span> <span style="color: #0000FF; font-weight: bold;">ON</span> <span style="color: #cc66cc;">0</span>
 <span style="color: #66cc66;">,</span><span style="color: #0000FF; font-weight: bold;">NON</span> <span style="color: #0000FF; font-weight: bold;">EMPTY</span> 
    <span style="color: #003300; font-weight: bold;">&#123;</span> 
        <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Date Time]</span>.<span style="color: #333333;">[Date Time]</span>.<span style="color: #0000FF;">MEMBERS</span> 
        <span style="color: #66cc66;">*</span> 
        <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[24 Hour]</span>.<span style="color: #333333;">[24 Hour]</span>.<span style="color: #0000FF;">ALLMEMBERS</span>
    <span style="color: #003300; font-weight: bold;">&#125;</span> <span style="color: #0000FF; font-weight: bold;">ON</span> <span style="color: #cc66cc;">1</span>
<span style="color: #0000FF; font-weight: bold;">FROM</span> 
<span style="color: #003300; font-weight: bold;">&#40;</span>
  <span style="color: #0000FF; font-weight: bold;">SELECT</span> 
    <span style="color: #0000FF;">Tail</span><span style="color: #003300; font-weight: bold;">&#40;</span>
         <span style="color: #0000FF;">Filter</span><span style="color: #003300; font-weight: bold;">&#40;</span>
               <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[24 Hour]</span>.<span style="color: #333333;">[24 Hour]</span>.<span style="color: #0000FF;">MEMBERS</span>
               <span style="color: #66cc66;">,</span><span style="color: #CC00FF;">Sum</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span><span style="color: #66cc66;">,</span><span style="color: #333333;">[Measures]</span>.<span style="color: #333333;">[Revenue]</span><span style="color: #003300; font-weight: bold;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>
         <span style="color: #003300; font-weight: bold;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #003300; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">ON</span> <span style="color: #cc66cc;">0</span>
  <span style="color: #0000FF; font-weight: bold;">FROM</span> 
  <span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #0000FF; font-weight: bold;">SELECT</span> 
      <span style="color: #003300; font-weight: bold;">&#123;</span>
            <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span>
            <span style="color: #66cc66;">:</span>
            <span style="color: #333333;">[Time]</span>.<span style="color: #333333;">[Calendar Date]</span>.<span style="color: #AF0000;">LastChild</span>.<span style="color: #AF0000;">Lag</span><span style="color: #003300; font-weight: bold;">&#40;</span><span style="color: #cc66cc;">13</span><span style="color: #003300; font-weight: bold;">&#41;</span>
      <span style="color: #003300; font-weight: bold;">&#125;</span> <span style="color: #0000FF; font-weight: bold;">ON</span> <span style="color: #cc66cc;">0</span>
    <span style="color: #0000FF; font-weight: bold;">FROM</span> <span style="color: #333333;">[Cube]</span>
  <span style="color: #003300; font-weight: bold;">&#41;</span>
<span style="color: #003300; font-weight: bold;">&#41;</span></pre></div></div>

<p>And to top it all off - after seeing the chart for a while, nobody liked it (after all, it's a relatively abstract view of revenue) and we dumped it.  <img src='http://timlaqua.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2009/02/wierd-slice-revenue-for-the-most-recent-hour-in-the-cube-across-the-last-seven-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

