<?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; mdx</title>
	<atom:link href="http://timlaqua.com/tag/mdx/feed/" rel="self" type="application/rss+xml" />
	<link>http://timlaqua.com</link>
	<description>Thoughts and Code from Tim Laqua</description>
	<lastBuildDate>Sun, 09 May 2010 15:25:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Reporting Services (SSRS/MSRS) 2008 Error: Set used with the complement operator must have all members from the same level</title>
		<link>http://timlaqua.com/2009/10/reporting-services-ssrsmsrs-2008-error-set-used-with-the-complement-operator-must-have-all-members-from-the-same-level/</link>
		<comments>http://timlaqua.com/2009/10/reporting-services-ssrsmsrs-2008-error-set-used-with-the-complement-operator-must-have-all-members-from-the-same-level/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 19:38:06 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[business intelligence]]></category>
		<category><![CDATA[mdx]]></category>
		<category><![CDATA[msrs]]></category>
		<category><![CDATA[reporting services]]></category>
		<category><![CDATA[ssrs]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=244</guid>
		<description><![CDATA[When you use the Not In operator in a SSRS 2008 MDX query filter to exclude a named set, it uses a the complement operator in the constructed MDX. This is fine as long as "all members [are] from the same level." Since you got this error, they are not You can get around this [...]]]></description>
			<content:encoded><![CDATA[<p>When you use the <strong>Not In</strong> operator in a SSRS 2008 MDX query filter to exclude a named set, it uses a the complement operator in the constructed MDX.  This is fine as long as "all members [are] from the same level."  Since you got this error, they are not <img src='http://timlaqua.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   You can get around this by using the Except() MDX function instead of letting SSRS use the Complement operator</p>
<p>In the ReportServerService log, you'll see something like this:<br />
<em>Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException: Query (..., ...) Set used with the complement operator must have all members from the same level.</em></p>
<p><u>Original filter</u><br />
Dimension: <strong>Time</strong><br />
Hierarchy: <strong>Calendar Date</strong><br />
Operator: <strong>Not In</strong><br />
Filter Expression: <strong>[Today]</strong></p>
<p><u>New filter</u><br />
Dimension: <strong>Time</strong><br />
Hierarchy: <strong>Calendar Date</strong><br />
Operator: <strong>MDX</strong><br />
Filter Expression: <strong>Except([Time].[Calendar Date].[Calendar Date].MEMBERS, [Today])</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2009/10/reporting-services-ssrsmsrs-2008-error-set-used-with-the-complement-operator-must-have-all-members-from-the-same-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notepad++ User Defined Language file for MDX Syntax Highlighting</title>
		<link>http://timlaqua.com/2009/03/notepad-user-defined-language-file-for-mdx-syntax-highlighting/</link>
		<comments>http://timlaqua.com/2009/03/notepad-user-defined-language-file-for-mdx-syntax-highlighting/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 15:54:38 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[mdx]]></category>
		<category><![CDATA[notepad++]]></category>
		<category><![CDATA[syntax highlighting]]></category>
		<category><![CDATA[user defined language]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=95</guid>
		<description><![CDATA[Following up on my previous post for GeSHi MDX Syntax Highlighting, here is a version for Notepad++. The only real issue I ran in to here is that the Nodepad++ User Language Definition system only allows two sets of boundary open/boundry close characters. One has to be square brackets - [...] - for MDX, and [...]]]></description>
			<content:encoded><![CDATA[<p>Following up on my previous post for <a href="http://timlaqua.com/2009/03/geshi-language-file-for-mdx-highlighting/">GeSHi MDX Syntax Highlighting</a>, here is a version for Notepad++.  The only real issue I ran in to here is that the Nodepad++ User Language Definition system only allows two sets of boundary open/boundry close characters.  One has to be square brackets - [...] - for MDX, and the other here would be a string delimiter.  This means only one string delimiter can be used at a time (because the square brackets took up the first slot) and I went with single quotes.  If you use double-quotes in your MDX rather than single quotes, you may want to switch the Delimiters element from:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Delimiters&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>[<span style="color: #ddbb00;">&amp;apos;</span>0]<span style="color: #ddbb00;">&amp;apos;</span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Delimiters&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>[<span style="color: #ddbb00;">&amp;quot;</span>0]<span style="color: #ddbb00;">&amp;quot;</span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>If you don't have any existing user defined languages, you can simply download the following file and put it in the appropriate location.  The appropriate location will vary depending on if you're using %APPDATA% or not.  If you are using %APPDATA%, the location will be <code>%APPDATA%\Notepad++</code></p>
<p>If you're not using %APPDATA%, the location is the Program Files folder for Notepad++ - usually something like <code>C:\Program Files\Notepad++</code>.  </p>
<p>Download: <a href='http://timlaqua.com/wp-content/uploads/2009/03/userdefinelang.xml'>userDefineLang.xml</a></p>
<p>If you already have existing user defined languages, you will need to edit your current userDefineLang.xml file and add the following UserLang node to your file (NodepadPlus is the root node - you only want to add in the UserLang node):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;NotepadPlus<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;UserLang</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;MDX&quot;</span> <span style="color: #000066;">ext</span>=<span style="color: #ff0000;">&quot;mdx&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Global</span> <span style="color: #000066;">caseIgnored</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TreatAsSymbol</span> <span style="color: #000066;">comment</span>=<span style="color: #ff0000;">&quot;no&quot;</span> <span style="color: #000066;">commentLine</span>=<span style="color: #ff0000;">&quot;no&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Prefix</span> <span style="color: #000066;">words1</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">words2</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">words3</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">words4</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;KeywordLists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Delimiters&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>[<span style="color: #ddbb00;">&amp;apos;</span>0]<span style="color: #ddbb00;">&amp;apos;</span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Folder+&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>SELECT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Folder-&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>FROM<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Operators&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>- ( ) * , . / : ; { | } + <span style="color: #ddbb00;">&amp;lt;</span> = <span style="color: #ddbb00;">&amp;gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Comment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>1/* 2*/ 0// 0--<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Words1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>WHERE COLUMNS ROWS NON EMPTY AS ON CALCULATE CASE EXISTING FREEZE IF SCOPE ALTER CUBE CREATE ACTION CELL CALCULATION GLOBAL WITH MEMBER SESSION SET SUBCUBE DROP SUBCUBE REFRESH CALL CLEAR CALCULATIONS DRILLTHROUGH UPDATE SetToArray This Leaves Current Item Root StrToTuple Error Hierarchy Dimension Dimensions Level Levels IsAncestor IsEmpty IsGeneration IsLeaf IsSibling CalculationPassValue CoalesceEmpty Generate IIf LookupCube MemberToStr Name Properties SetToStr TupleToStr UniqueName UserName<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Words2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Aggregate Avg CalculationCurrentPass CalculationPassValue CoalesceEmpty Correlation Count Covariance CovarianceN DistinctCount IIf LinRegIntercept LinRegPoint LinRegR2 LinRegSlope LookupCube Max Median Min Ordinal Predict Rank RollupChildren Stddev StddevP StrToValue Sum Value Var Variance VarianceP VarP<span style="color: #ddbb00;">&amp;#x0009;&amp;#x0009;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Words3&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>AllCalculatedMembers AllMembers Ancestors Ascendants Axis BottomCount BottomPercent BottomSum Children Crossjoin CurrentOrdinal Descendants Distinct DrilldownLevel DrilldownLevelBottom DrilldownLevelTop DrilldownMember DrilldownMemberBottom DrilldownMemberTop DrillupLevel DrillupMember Except Exists Extract Filter Generate Head Hierarchize Intersect LastPeriods Members Mtd NameToSet NonEmptyCrossjoin Order PeriodsToDate Qtd Siblings StripCalculatedMembers StrToSet Subset Tail ToggleDrillState TopCount TopPercent TopSum Union Unorder VisualTotals Wtd Ytd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Keywords</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Words4&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Ancestor ClosingPeriod Cousin CurrentMember DataMember DefaultMember FirstChild FirstSibling Item Lag LastChild LastSibling Lead LinkMember NextMember OpeningPeriod ParallelPeriod Parent PrevMember StrToMember UnknownMember ValidMeasure<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Keywords<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/KeywordLists<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Styles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DEFAULT&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;11&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;FOLDEROPEN&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;12&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;0000FF&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;FOLDERCLOSE&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;13&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;0000FF&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;KEYWORD1&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;0000FF&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;KEYWORD2&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;6&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;FF0000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;KEYWORD3&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;7&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;804000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;KEYWORD4&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;804000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;COMMENT&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;COMMENT LINE&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;NUMBER&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;800040&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;OPERATOR&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DELIMINER1&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;14&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DELIMINER2&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;15&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;6C6C6C&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;Courier New&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WordsStyle</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DELIMINER3&quot;</span> <span style="color: #000066;">styleID</span>=<span style="color: #ff0000;">&quot;16&quot;</span> <span style="color: #000066;">fgColor</span>=<span style="color: #ff0000;">&quot;000000&quot;</span> <span style="color: #000066;">bgColor</span>=<span style="color: #ff0000;">&quot;FFFFFF&quot;</span> <span style="color: #000066;">fontName</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">fontStyle</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Styles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/UserLang<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/NotepadPlus<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2009/03/notepad-user-defined-language-file-for-mdx-syntax-highlighting/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>GeSHi Language file for MDX Syntax Highlighting</title>
		<link>http://timlaqua.com/2009/03/geshi-language-file-for-mdx-highlighting/</link>
		<comments>http://timlaqua.com/2009/03/geshi-language-file-for-mdx-highlighting/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 04:45:00 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[geshi]]></category>
		<category><![CDATA[mdx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[syntax highlighting]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=86</guid>
		<description><![CDATA[For years now, it's bothered me that there was no syntax highlighting for MDX in GeSHi - so I put a language file together for MDX. To use this file: download it, unzip it, and put the mdx.php file in to your GeSHi languages folder (for WordPress wp-syntax, this is themes/wp-syntax/geshi/geshi) - it's the folder [...]]]></description>
			<content:encoded><![CDATA[<p>For years now, it's bothered me that there was no syntax highlighting for MDX in GeSHi - so I put a language file together for MDX.  To use this file: download it, unzip it, and put the <strong>mdx.php</strong> file in to your GeSHi languages folder (for WordPress wp-syntax, this is themes/wp-syntax/geshi/geshi) - it's the folder with all the languagename.php files in it.</p>
<p>Let me know if it doesn't catch something or if you have suggestions for how to highlight keywords differently.</p>
<p>Download: <a href='http://timlaqua.com/wp-content/uploads/2009/03/geshi-mdx.zip'>geshi-mdx.zip</a></p>
<p>You can also copy and paste the following in to a new file and name it mdx.php - then place it in the appropriate folder: <span id="more-86"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*************************************************************************************
 * mdx.php
 * -------
 * Author: Tim Laqua (t.laqua@gmail.com)
 * Copyright: (c) 2009 Tim Laqua (http://timlaqua.com/)
 * Release Version: &lt;none&gt;
 * Date Started: 2009/03/07
 *
 * MDX language file for GeSHi.
 *
 * CHANGES
 * -------
 * 2009/03/07 (1.0.0)
 *  -  First Release
 *
 *************************************************************************************
 *
 *     This file is part of GeSHi.
 *
 *   GeSHi is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   GeSHi is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GeSHi; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 ************************************************************************************/</span>
&nbsp;
<span style="color: #000088;">$language_data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'LANG_NAME'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'MDX'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'COMMENT_SINGLE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'//'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'--'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'COMMENT_MULTI'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/*'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'*/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'CASE_KEYWORDS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'COMMENT_REGEXP'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'/\[[a-z0-9 %]+\]/i'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>	
    <span style="color: #0000ff;">'QUOTEMARKS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'`'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'ESCAPE_CHAR'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'\\'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'KEYWORDS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'WHERE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'WITH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'COLUMNS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ROWS'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'FROM'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'NON'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'EMPTY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'AS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ON'</span><span style="color: #339933;">,</span>
			<span style="color: #666666; font-style: italic;">// Scripting Statements</span>
			<span style="color: #0000ff;">'CALCULATE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CASE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'EXISTING'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'FREEZE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'IF'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'SCOPE'</span><span style="color: #339933;">,</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Data Definition Statements</span>
			<span style="color: #0000ff;">'ALTER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CUBE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CREATE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ACTION'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CELL CALCULATION'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'GLOBAL'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'MEMBER'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'SESSION'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'SET'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'SUBCUBE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'DROP'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'SUBCUBE'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'REFRESH'</span><span style="color: #339933;">,</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Data Manipulation Statements</span>
			<span style="color: #0000ff;">'CALL'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CLEAR'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CALCULATIONS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'DRILLTHROUGH'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'SELECT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UPDATE'</span>
&nbsp;
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #666666; font-style: italic;">// Array Functions</span>
			<span style="color: #0000ff;">'SetToArray'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Hierarchy Functions</span>
			<span style="color: #0000ff;">'Hierarchy'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Dimension'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Dimensions'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Level Functions</span>
			<span style="color: #0000ff;">'Level'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Levels'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Logical Functions</span>
			<span style="color: #0000ff;">'IsAncestor'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IsEmpty'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IsGeneration'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IsLeaf'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IsSibling'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Member Functions</span>
			<span style="color: #0000ff;">'Ancestor'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'ClosingPeriod'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Cousin'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CurrentMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DataMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DefaultMember'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'FirstChild'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'FirstSibling'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Item'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Lag'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LastChild'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'LastSibling'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Lead'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LinkMember'</span><span style="color: #339933;">,</span><span style="color: #666666; font-style: italic;">/*'Members',*/</span> <span style="color: #0000ff;">'NextMember'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'OpeningPeriod'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'ParallelPeriod'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Parent'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'PrevMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'StrToMember'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'UnknownMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'ValidMeasure'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">7</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Numeric Functions</span>
			<span style="color: #0000ff;">'Aggregate'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Avg'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CalculationCurrentPass'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CalculationPassValue'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CoalesceEmpty'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Correlation'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Count'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Covariance'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'CovarianceN'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DistinctCount'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'IIf'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LinRegIntercept'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LinRegPoint'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LinRegR2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LinRegSlope'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'LookupCube'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Max'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Median'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Min'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Ordinal'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Predict'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Rank'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'RollupChildren'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Stddev'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'StddevP'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'StrToValue'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Sum'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Value'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Var'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Variance'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'VarianceP'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'VarP'</span>		
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">8</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Set Functions</span>
			<span style="color: #0000ff;">'AllCalculatedMembers'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'AllMembers'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Ancestors'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Ascendants'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Axis'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'BottomCount'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'BottomPercent'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'BottomSum'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Children'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Crossjoin'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'CurrentOrdinal'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Descendants'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Distinct'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrilldownLevel'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrilldownLevelBottom'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'DrilldownLevelTop'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrilldownMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrilldownMemberBottom'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrilldownMemberTop'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'DrillupLevel'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'DrillupMember'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Except'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Exists'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Extract'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Filter'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Generate'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Head'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Hierarchize'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Intersect'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'LastPeriods'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Members'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Mtd'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'NameToSet'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'NonEmptyCrossjoin'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Order'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'PeriodsToDate'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Qtd'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Siblings'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'StripCalculatedMembers'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'StrToSet'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Subset'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Tail'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'ToggleDrillState'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'TopCount'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'TopPercent'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'TopSum'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Union'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Unorder'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'VisualTotals'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Wtd'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'Ytd'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">9</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// String Functions</span>
			<span style="color: #0000ff;">'CalculationPassValue'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CoalesceEmpty'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Generate'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IIf'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'LookupCube'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'MemberToStr'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Properties'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'SetToStr'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'TupleToStr'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UniqueName'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'UserName'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">10</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Subcube Functions</span>
			<span style="color: #0000ff;">'This'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Leaves'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">11</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Tuple Functions</span>
			<span style="color: #0000ff;">'Current'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Item'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Root'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'StrToTuple'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">12</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Other Functions</span>
			<span style="color: #0000ff;">'Error'</span>
			<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'SYMBOLS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #666666; font-style: italic;">// Operators</span>
        <span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'='</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'{'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'}'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'+'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'*'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'^'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//, '.'</span>
		<span style="color: #0000ff;">':'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;='</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;='</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'AND'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'NOT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'OR'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'XOR'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'::='</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'CASE_SENSITIVE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        GESHI_COMMENTS <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		<span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'STYLES'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'KEYWORDS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000FF; font-weight: bold;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #00FFFF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #00CCCC;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000CC;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #FF00FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #AF0000;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">7</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #CC00FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">8</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">9</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #FF00FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">10</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">11</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000FF;'</span><span style="color: #339933;">,</span>
			<span style="color: #cc66cc;">12</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #0000FF;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'COMMENTS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #808080; font-style: italic;'</span><span style="color: #339933;">,</span>
            <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #808080; font-style: italic;'</span><span style="color: #339933;">,</span>
            <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #333333;'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'MULTI'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #808080; font-style: italic;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'ESCAPE_CHAR'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #000099; font-weight: bold;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'BRACKETS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #003300; font-weight: bold;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'STRINGS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #ff0000;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'NUMBERS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #cc66cc;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'METHODS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #004000;'</span><span style="color: #339933;">,</span>
            <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #004000;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'SYMBOLS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #66cc66;'</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'SCRIPT'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'REGEXPS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'color: #000088;'</span>
            <span style="color: #009900;">&#41;</span>
         <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'URLS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'OOLANG'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'OBJECT_SPLITTERS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'REGEXPS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'STRICT_MODE_APPLIES'</span> <span style="color: #339933;">=&gt;</span> GESHI_MAYBE<span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'SCRIPT_DELIMITERS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'HIGHLIGHT_STRICT_BLOCK'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2009/03/geshi-language-file-for-mdx-highlighting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>
		<item>
		<title>Dynamic MDX queries in TSQL</title>
		<link>http://timlaqua.com/2008/07/dynamic-mdx-queries-in-tsql/</link>
		<comments>http://timlaqua.com/2008/07/dynamic-mdx-queries-in-tsql/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 00:15:13 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[analysis services]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[business intelligence]]></category>
		<category><![CDATA[mdx]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssas]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=37</guid>
		<description><![CDATA[Say you want to run the same MDX query for each row in a given rowset. I needed to do this for alerting purposes, where there were different alert thresholds for different attribute values in a given dimension attribute. After struggling with passing a variable to the query argument of the OPENROWSET command, I finally [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to run the same MDX query for each row in a given rowset.  I needed to do this for alerting purposes, where there were different alert thresholds for different attribute values in a given dimension attribute.  After struggling with passing a variable to the query argument of the OPENROWSET command, I finally found the documentation that clearly stated that the query argument CAN'T be a variable.  Or a concatination of a string and a variable.  I still don't understand why...  but the suggested workaround is to construct a giant TSQL string and run it using the EXEC command.</p>
<p>Ok - but how do we get the results of the query?  Basically, the only way to do this is to create a temporary table in the current scope and do an INSERT INTO that temp table in your giant TSQL query.  It all ends up looking something like this:<br />
<span id="more-37"></span></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">DECLARE @PercentOfAverage <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
DECLARE @Yesterday <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
DECLARE @SevenDayAverage <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> SliceName<span style="color: #66cc66;">,</span>Threshold
<span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #808080; font-style: italic;">#Temp_SliceList</span>
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#40;</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'Slice1'</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'SliceName'</span><span style="color: #66cc66;">,</span> <span style="color: #66cc66;">.</span>8 <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">'Threshold'</span>
	<span style="color: #993333; font-weight: bold;">UNION</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #ff0000;">'Slice2'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0.9</span>
<span style="color: #66cc66;">&#41;</span> a
&nbsp;
DECLARE @tsql NVARCHAR<span style="color: #66cc66;">&#40;</span>MAX<span style="color: #66cc66;">&#41;</span>
&nbsp;
DECLARE @slice VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
DECLARE @threshold DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
DECLARE @slicecursor CURSOR
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> @slicecursor <span style="color: #66cc66;">=</span> CURSOR <span style="color: #993333; font-weight: bold;">FOR</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> slicename<span style="color: #66cc66;">,</span>threshold <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #808080; font-style: italic;">#Temp_SliceList</span>
&nbsp;
OPEN @slicecursor
&nbsp;
FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> @slicecursor <span style="color: #993333; font-weight: bold;">INTO</span> @slice<span style="color: #66cc66;">,</span> @threshold
&nbsp;
WHILE <span style="color: #66cc66;">&#40;</span>@@FETCH_STATUS <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
BEGIN
&nbsp;
&nbsp;
	<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Temp_MdxResults </span>
	  <span style="color: #66cc66;">&#40;</span>Yesterday DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		SevenDayAverage DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		PercentOfAverage DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
	<span style="color: #993333; font-weight: bold;">SET</span> @tsql <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'
INSERT INTO #Temp_MdxResults (Yesterday, SevenDayAverage, PercentOfAverage)
SELECT    ISNULL(&quot;[Measures].[Yesterday Foo]&quot;, 0) AS '</span><span style="color: #ff0000;">'Yesterday'</span><span style="color: #ff0000;">',
						ISNULL(&quot;[Measures].[Average 7-Day Foo]&quot;, 0) AS '</span><span style="color: #ff0000;">'SevenDayAverage'</span><span style="color: #ff0000;">',
						ISNULL(&quot;[Measures].[Percent Change]&quot;, 0) AS '</span><span style="color: #ff0000;">'PercentOfAverage'</span><span style="color: #ff0000;">'
			  FROM      OpenRowset('</span><span style="color: #ff0000;">'MSOLAP'</span><span style="color: #ff0000;">',
								   '</span><span style="color: #ff0000;">'DATA SOURCE=SERVER<span style="color: #000099; font-weight: bold;">\I</span>NSTANCE; Initial Catalog=SSASDB;'</span><span style="color: #ff0000;">','</span><span style="color: #ff0000;">'
WITH 
MEMBER Measures.[Yesterday Foo] AS SUM
(
	{
		StrToMember(&quot;[Time].[Calendar Date].[&quot; + VBA!format(VBA!dateadd(&quot;d&quot;,-1,VBA![date]()),&quot;yyyy-MM-dd 00:00:00&quot;) + &quot;]&quot;)
	},
	[Measures].[Foo]		
)
MEMBER Measures.[Average 7-Day Foo] AS AVG
(
	{
		StrToMember(&quot;[Time].[Calendar Date].[&quot; + VBA!format(VBA!dateadd(&quot;d&quot;,-2,VBA![date]()),&quot;yyyy-MM-dd 00:00:00&quot;) + &quot;]&quot;):StrToMember(&quot;[Time].[Calendar Date].[&quot; + VBA!format(VBA!dateadd(&quot;d&quot;,-9,VBA![date]()),&quot;yyyy-MM-dd 00:00:00&quot;) + &quot;]&quot;)
	},
	[Measures].[Foo]		
)
MEMBER Measures.[Percent Change] AS Measures.[Yesterday Foo]/Measures.[Average 7-Day Foo]
SELECT 
{Measures.[Yesterday Foo], Measures.[Average 7-day Foo], Measures.[Percent Change]} ON 0,
{
	[Slice Dimension].[Slice Attribute].&amp;['</span> <span style="color: #66cc66;">+</span> @slice <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">']
}ON 1
FROM [Cube]'</span><span style="color: #ff0000;">') a'</span>
&nbsp;
	EXEC <span style="color: #66cc66;">&#40;</span>@tsql<span style="color: #66cc66;">&#41;</span>
&nbsp;
	<span style="color: #993333; font-weight: bold;">SELECT</span>  
		@PercentOfAverage <span style="color: #66cc66;">=</span> CAST<span style="color: #66cc66;">&#40;</span>tot<span style="color: #66cc66;">.</span>PercentOfAverage <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		@Yesterday <span style="color: #66cc66;">=</span> CAST<span style="color: #66cc66;">&#40;</span>tot<span style="color: #66cc66;">.</span>Yesterday <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		@SevenDayAverage <span style="color: #66cc66;">=</span> CAST<span style="color: #66cc66;">&#40;</span>tot<span style="color: #66cc66;">.</span>SevenDayAverage <span style="color: #993333; font-weight: bold;">AS</span> DECIMAL<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #993333; font-weight: bold;">FROM</span>    <span style="color: #808080; font-style: italic;">#Temp_MdxResults tot</span>
&nbsp;
	<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Temp_MdxResults</span>
&nbsp;
	<span style="color: #993333; font-weight: bold;">IF</span> @PercentOfAverage <span style="color: #66cc66;">&lt;</span> @Threshold 
		BEGIN
			<span style="color: #808080; font-style: italic;">--Do Something useful here</span>
&nbsp;
		END
	FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> @slicecursor <span style="color: #993333; font-weight: bold;">INTO</span> @slice<span style="color: #66cc66;">,</span> @threshold
END</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2008/07/dynamic-mdx-queries-in-tsql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
