<?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>简单生活 -- Kevin Yang的博客 &#187; 维度</title>
	<atom:link href="http://www.imkevinyang.com/tags/%e7%bb%b4%e5%ba%a6/feed" rel="self" type="application/rss+xml" />
	<link>http://www.imkevinyang.com</link>
	<description>It&#039;s all about sharing</description>
	<lastBuildDate>Sun, 05 Feb 2012 15:37:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Analysis Services：你应该使用多对多维度吗？</title>
		<link>http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html</link>
		<comments>http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html#comments</comments>
		<pubDate>Sun, 11 Apr 2010 17:29:58 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[BI/数据库]]></category>
		<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[OLAP]]></category>
		<category><![CDATA[多对多]]></category>
		<category><![CDATA[度量组]]></category>
		<category><![CDATA[性能优化]]></category>
		<category><![CDATA[维度]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html</guid>
		<description><![CDATA[如果你是一个初学者，请注意，这篇文章并不是告诉你不要在Analysis Services中使用多对多（m:n）维度。事实上，这是一个非常棒的功能，它允许你将多个维度成员和多条事实数据之间建立关联关系。在很多商业领域，从零售行业到会计行业到医疗行业，多对多关系被大量使用着。但有时在处理多对多关系时，如果遇到大规模数据量，可能会遇到数据查询性能问题以及数据精准性问题。这篇技术文章就是为了说明多对多关系背后的工作原理和适合的商业应用场景，以及应用多对多关系可能带来的数据精准性问题。]]></description>
			<content:encoded><![CDATA[<div class="statement">
<p>作者：Denny Lee</p>
<p>译者：<a href="http://www.imkevinyang.com/2010/04/Analysis%20Services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html">Kevin Yang</a></p>
<p>英文链接：<a title="http://sqlcat.com/technicalnotes/archive/2008/02/11/analysis-services-should-you-use-many-to-many-dimensions.aspx" href="http://sqlcat.com/technicalnotes/archive/2008/02/11/analysis-services-should-you-use-many-to-many-dimensions.aspx">http://sqlcat.com/technicalnotes/archive/2008/02/11/analysis-services-should-you-use-many-to-many-dimensions.aspx</a></p>
</div>
<p>如果你是一个初学者，请注意，这篇文章并不是告诉你不要在Analysis Services中使用多对多（m:n）维度。事实上，这是一个非常棒的功能，它允许你将多个维度成员和多条事实数据之间建立关联关系。在很多商业领域，从零售行业到会计行业到医疗行业，多对多关系被大量使用着。但有时在处理多对多关系时，如果遇到大规模数据量，可能会遇到数据查询性能问题以及数据精准性问题。这篇技术文章就是为了说明多对多关系背后的工作原理和适合的商业应用场景，以及应用多对多关系可能带来的数据精准性问题。</p>
<h2>相关背景</h2>
<p>我在我之前的博文“<a href="http://denster.spaces.live.com/blog/cns%21125D53A08EC75357%21283.entry">How to handle many-to-many relationships in Yukon?</a>”中提到的应用多对多关系的一个例子是地理维度。但现在我们将使用Adventure Works DW OLAP这个示例（相关代码在Codeplex的<a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004">SQL Server 2005 SP2 Sample Databases</a>上可以下载到）。</p>
<p>打开AdventureWorks数据库，在AdventureWorks数据立方体的“维度使用”标签卡下，我们可以看到[Sales Reason]维度通过[Sales Reasons]中间度量组关联到了[Internet Sales]度量组（图中没有显示）上。[Sales Reasons]旁边放了一个数学上用于表示“无穷”的图标，说明这个关系和常规维度（就像[Source Currency]维度和[Source Currency Code]度量组的关系）不一样，这是一个多对多关系。</p>
<p><a href="http://sqlcat.com/blogs/technicalnotes/WindowsLiveWriter/AnalysisServicesShouldyouusemanytomanydi_8E4E/image_2.png"><img style="display: inline; border: 0px;" title="在BIDS中[Sales Reason]和[Internet Sales]的多对多关系图" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/clip_image001.png" border="0" alt="在BIDS中[Sales Reason]和[Internet Sales]的多对多关系图" width="351" height="71" /></a></p>
<p>单击[Sales Reasons]度量组，会弹出一个设计维度-度量组关联的对话框（见下图），在这里，你会注意到，[Sales Reason]和[Internet Sales]这两者之间的关系是多对多关系，并且，连接[Sales Reason]维度和[Internet Sales]度量组的中间度量组是[Sales Reasons]。</p>
<p><a href="http://sqlcat.com/blogs/technicalnotes/WindowsLiveWriter/AnalysisServicesShouldyouusemanytomanydi_8E4E/image_4.png"><img style="display: inline; border: 0px;" title="在BIDS中设计多对多关系" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/clip_image002.png" border="0" alt="在BIDS中设计多对多关系" width="461" height="272" /></a></p>
<p>以下这张图说明了在这个场景中使用多对多维度的目的。我们希望把多个销售成功因素（例如价格很低，展示效果不错，或者其他因素）和一笔销售订单关联起来。</p>
<p><a href="http://sqlcat.com/blogs/technicalnotes/WindowsLiveWriter/AnalysisServicesShouldyouusemanytomanydi_8E4E/image_6.png"><img style="display: inline; border: 0px;" title="销售因素和销售情况之间的维度-度量组关系图" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/clip_image003.png" border="0" alt="销售因素和销售情况之间的维度-度量组关系图" width="382" height="195" /></a></p>
<p>举个例子，John购买了一个高清电视机（对应事实表Internet Sales的一条记录），是因为最近正在大减价（销售成功因素：价格）并且超级联赛杯快要开始了（销售成功因素：其他）。</p>
<h2>应用场景示例</h2>
<p>我们回过头来看看[Adventure Works]的Sql以及Olap数据库的设计，这样可以更好地从技术上去理解多对多关系。在之前我们看到的[Adventure Works DW]Olap数据库中包含了[Internet Sales]和[Sales Reasons]度量组，以及[Sales Reason]维度。在AdventureWorks的Sql数据库中，这几个对象分别对应着FactInternetSales、FactInternetSalesReasons以及DimSalesReason表。</p>
<p>继续我们上面的例子，为了简单起见，我们只关注两条数据(SalesOrderNumber = 'SO69868', SalesOrderLineNumber = 2) 和(SalesOrderNumber = 'SO75088', SalesOrderLineNumber = 3)。</p>
<p>Sql查询为：</p>
<pre class="csharpcode"><span class="kwrd">select</span> SalesOrderNumber, SalesOrderLineNumber, SalesAmount
<span class="kwrd">from</span> FactInternetSales
<span class="kwrd">where</span> (SalesOrderNumber = <span class="str">'SO69868'</span> <span class="kwrd">and</span> SalesOrderLineNumber = 2) <span class="kwrd">or</span>
(SalesOrderNumber = <span class="str">'SO75088'</span> <span class="kwrd">and</span> SalesOrderLineNumber = 3)</pre>
<p>结果集：</p>
<p><img style="display: inline; border: 0px;" title="两笔订单交易数据" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image.png" border="0" alt="两笔订单交易数据" width="305" height="66" /></p>
<p>当你开始考虑FactInternetSales和FactInternetSalesReasons的多对多关系，需要将SalesReason表也加进来，你需要执行以下Sql查询：</p>
<pre class="csharpcode"><span class="kwrd">select</span> a.SalesOrderNumber, a.SalesOrderLineNumber, a.SalesAmount,
c.SalesReasonKey, c.SalesReasonName, c.SalesReasonReasonType
<span class="kwrd">from</span> FactInternetSales a
<span class="kwrd">inner</span> <span class="kwrd">join</span> FactInternetSalesReason b
<span class="kwrd">on</span> b.SalesOrderNumber = a.SalesOrderNumber
<span class="kwrd">and</span> b.SalesOrderLineNumber = a.SalesOrderLineNumber
<span class="kwrd">inner</span> <span class="kwrd">join</span> DimSalesReason c
<span class="kwrd">on</span> c.SalesReasonKey = b.SalesReasonKey
<span class="kwrd">where</span> (a.SalesOrderNumber = <span class="str">'SO69868'</span> <span class="kwrd">and</span> a.SalesOrderLineNumber = 2) <span class="kwrd">or</span>
(a.SalesOrderNumber = <span class="str">'SO75088'</span> <span class="kwrd">and</span> a.SalesOrderLineNumber = 3)</pre>
<p>新的结果集如下：</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image1.png" border="0" alt="image" width="566" height="82" /></p>
<p>从这两张表中你也可以看出，通过中间表FactInternetSalesReasons，你可以将多条销售成功因素记录关联到同一笔销售订单上。例如上述的SO75088订单，金额为$34.99，关联着“价格”和“其他”两条销售成功因素记录。</p>
<h2>多对多维度的优势</h2>
<p>这种通过中间表关联的优势在于，你可以将多个维度成员和一个事实表记录关联到一起。当你想要汇总这些值的时候，优势就体现出来了。例如，当你使用[Sales Reason]维度去查询[Internet Sales]度量组的时候，可以得到以下结果：</p>
<pre class="csharpcode"><span class="kwrd">select</span> {[Measures].[Internet Sales Amount]} <span class="kwrd">on</span> columns,
{[Sales Reason].[Sales Reason].members} <span class="kwrd">on</span> <span class="kwrd">rows</span>
<span class="kwrd">from</span> [Adventure Works]</pre>
<p><img style="display: inline; border: 0px;" title="不同销售成功因素对于销售的影响" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image2.png" border="0" alt="不同销售成功因素对于销售的影响" width="416" height="259" /></p>
<p>上述结果集里头，由于[Price]和[Others]这两个销售成功因素都是SO75088这个订单成功的因素，因此其销售额都包含了SO75088订单的金额。而更不错的是，你现在有了一个[All Sales Reasons]的成员，用来表示总的销售金额$29,358,677.22。</p>
<p>你如果直接查询[Measures].[Internet Sales Amount]指标，得到的结果也是一样的。</p>
<pre class="csharpcode"><span class="kwrd">select</span> {[Measures].[Internet Sales Amount]} <span class="kwrd">on</span> columns
<span class="kwrd">from</span> [Adventure Works]</pre>
<h2>数据精准性问题</h2>
<p>使用多对多维度的一个潜在问题就是数据重复计算，特别是当用户没能很好理解多对多背后原理的话，更有可能出现这种情况。例如，我们执行以下MDX查询：</p>
<pre class="csharpcode"><span class="kwrd">select</span> {[Measures].[Internet Sales Amount]} <span class="kwrd">on</span> columns,
{[Sales Reason].[Sales Reason].children} <span class="kwrd">on</span> <span class="kwrd">rows</span>
<span class="kwrd">from</span> [Adventure Works]</pre>
<p>得到以下结果：</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image3.png" border="0" alt="image" width="383" height="235" /></p>
<p>得到这样的数据之后，用户可能会直接使用上述的数据相加来计算总的销售金额，从而得到以下结果：</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image4.png" border="0" alt="image" width="385" height="256" /></p>
<p>注意，这里的总和$30,856,531.52和前面提到的[All Sales Reasons]成员的汇总值$29,358,677.22很不一样，相差了$1,497,854.30，如果你从事金融方面工作的话，这个差别应该是足够明显了。</p>
<p>问题的复杂之处在于，当你应用多对多维度的时候，你无从知道那些成员会被重复计算，因为任何一单销售都有可能和任何一个销售成功因素关联。例如用户有可能直接把[Other]和[Price]成员的销售额相加，得到因为这两个原因而成交的订单销售额情况$11,224,325.90。但是这样的结果是错误的，因为有一些销售订单同时包含了这两个销售成功因素。因此总和应该是小于$11,224,325.90的。</p>
<h2>有别的解决办法吗？</h2>
<p>“是否应该使用多对多维度”，你主要需要考虑两个方面的问题：性能和数据精准性。</p>
<h3>性能</h3>
<p>在<a href="http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/ssas2005perfguide.doc">Analysis Services 性能指南</a>中提到，有时候应用多对多是出于性能的考虑，其中一个情形就是对Distinct Count类型的度量进行泛化。使用多对多维度可以让你通过Analysis Services的sum、count、max、min等运算符实现和Distinct Count一样的逻辑。为了计算Distinct Count或者Sum，Analysis Services存储引擎需要直接对最小粒度的数据做转换。这是因为，当一个查询涉及到多对多维度的时候，聚合结果是在查询期间通过目标度量组和中间度量组在属性级别上完成的。查询的过程相对比较消耗CPU和内存。</p>
<p>多对多的性能考虑主要包括以下几个方面：</p>
<ul>
<li>因为查询涉及到多对多维度，会在目标度量分组和中间度量分组之间生成一个Join连接，因此降低中间度量组的表大小（通常小于1百万行数据）可以提高查询性能。细节参考：<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3494E712-C90B-4A4E-AD45-01009C15C665&amp;displaylang=en">Analysis Services Many-to-Many Dimensions: Query Performance Optimization Techniques</a> 白皮书。</li>
<li>目标度量组和中间度量组之间的连接是哈希连接，因此完成此项操作非常消耗内存。</li>
<li>和Distinct Count不同，多对多关系不能被预聚合（虽然通常对于Distinct Count来说，要设计通用的预聚合也不是一件容易的事）。因此，涉及到多对多维度的查询无法使用预聚合或者聚合缓存，除非直接命中才有效。不过在几种特殊情形下多对多关系还是有可能被预聚合的，详细信息参考：Analysis Services Many-to-Many Dimensions: Query Performance Optimization 技术白皮书。</li>
<li>因为多对多无法被预聚合，很多MDX计算例如VisualTotals，subselects和Create Subcube都会遇到问题。</li>
</ul>
<h3>数据精准性</h3>
<p>正如你在“数据精准性问题”这一节中看到的，在应用多对多关系的场景中你可能会得不到期望的值（例如重复计算）。所以，即便这是一项非常强大的功能，如果用户没有认识到背后的多对多关系，他可能会得到错误的结果。</p>
<h2>分析</h2>
<p>你可以参考Marco Russo写的<a title="Many-to-many维度建模" href="http://www.sqlbi.eu/Default.aspx?tabid=80" target="_blank">Many-to-many维度建模</a>，里头提及了很多基于多对多维度关系之上建模的解决方案。对于数据仓库以及商业智能问题来说，“是否应该使用多对多维度”这个问题，不存在一个绝对的答案。重要的是，你在实际应用之前，首先需要理解多对多背后的含义。</p>
<p>在 [Sales Reason]这个示例中，有多种情况可以判断是否应该使用多对多维度：</p>
<h3>你想要多对多关系，并且经常会使用Sales Reason维度去剖析数据。</h3>
<p>如果你经常需要使用Sales Reason维度去剖析数据，那么你其实并不需要一个中间度量组。在这个场景中，你可以将[FactInternetSales]和[FactInternetSalesReason]表合成一张新的事实表，然后基于这张表上建立新的数据立方体。因为你经常需要使用sales reason维度去剖析数据，当你使用[Price]成员去剖析数据的时候，以下高亮的行会被选中：</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image5.png" border="0" alt="image" width="546" height="81" /></p>
<p>如果你选择了[Other]成员来剖析的话，以下高亮的行会被选中：</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image6.png" border="0" alt="image" width="539" height="79" /></p>
<p>如果你想要获取汇总值，例如总销售额，你可以基于FactInternetSales表建立新的数据立方体，这样就不需要通过中间度量分组。</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image7.png" border="0" alt="image" width="303" height="68" /></p>
<h3>你实际上并不需要多对多关系</h3>
<p>在我们这个场景中，实际上根本并不需要多对多关系。想想看，事实上，我们只需要规定，每笔销售订单只允许有一个销售成功因素即可。</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image8.png" border="0" alt="image" width="464" height="34" /></p>
<p>或</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image9.png" border="0" alt="image" width="467" height="35" /></p>
<p>另外一种处理办法是将此订单的销售额分摊到不同的销售成功因素上。</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/04/image10.png" border="0" alt="image" width="486" height="51" /></p>
<h2>结论</h2>
<p>注意，以上说的这些并不是要告诉你，不要去使用多对多维度。这是一项非常棒的功能，它让用户能够实现他们想要的效果——将多个维度成员关联到同一个事实表记录上，同时在计算总和的时候又不会出现重复计算的问题。但需要注意，使用多对多维度对于汇总值的影响（例如，将所有单元格的值汇总起来并不总是等于实际的总值）还有它对于其他维度的影响。同时，还需要考虑性能方面的问题，虽然在<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3494E712-C90B-4A4E-AD45-01009C15C665&amp;displaylang=en">Analysis Services Many-to-Many Dimensions: Query Performance Optimization </a>技术白皮书中已经对如何优化多对多的查询性能做出了指导。在处理多对多问题上还有其他的解决方案，所以请确保你已经考虑过这些解决方案，并且已经理解了多对多的潜在问题。</p>
<p style="text-align: right;">——<a title="Analysis Services：你应该使用多对多维度吗？" href="http://www.imkevinyang.com/2010/04/Analysis%20Services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/analysis-services" title="Analysis Services" rel="tag">Analysis Services</a>, <a href="http://www.imkevinyang.com/categories/techarticles/businessintelligence" title="BI/数据库" rel="tag">BI/数据库</a>, <a href="http://www.imkevinyang.com/tags/olap" title="OLAP" rel="tag">OLAP</a>, <a href="http://www.imkevinyang.com/tags/%e5%a4%9a%e5%af%b9%e5%a4%9a" title="多对多" rel="tag">多对多</a>, <a href="http://www.imkevinyang.com/tags/%e5%ba%a6%e9%87%8f%e7%bb%84" title="度量组" rel="tag">度量组</a>, <a href="http://www.imkevinyang.com/tags/%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96" title="性能优化" rel="tag">性能优化</a>, <a href="http://www.imkevinyang.com/tags/%e7%bb%b4%e5%ba%a6" title="维度" rel="tag">维度</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html" title="64位系统下IIS7 ISAPI处理器加载失败 (2010/05/05)">64位系统下IIS7 ISAPI处理器加载失败</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/05/analysis-service-2005-olap-best-practice-white-paper.html" title="Analysis Service 2005 OLAP Best Practice White Paper (2009/05/22)">Analysis Service 2005 OLAP Best Practice White Paper</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/04/analysis-services-2005-olap%e8%ae%be%e8%ae%a1%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5.html" title="Analysis Services 2005 OLAP设计最佳实践 (2009/04/02)">Analysis Services 2005 OLAP设计最佳实践</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html" title="BIDS对于维度属性键为可变长列时存在的Bug (2009/03/22)">BIDS对于维度属性键为可变长列时存在的Bug</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e9%83%a8%e7%bd%b2%e6%97%b6%e5%87%ba%e7%8e%b0%e5%85%83%e6%95%b0%e6%8d%ae%e7%ae%a1%e7%90%86%e5%99%a8%e5%8f%91%e7%94%9f%e9%94%99%e8%af%af.html" title="BIDS部署时出现元数据管理器发生错误 (2009/03/13)">BIDS部署时出现元数据管理器发生错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html" title="Google Analytics中的Page维度 (2010/01/04)">Google Analytics中的Page维度</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/08/olap%e4%b8%ad%e7%9a%84averageofchildren%e8%81%9a%e5%90%88%e6%96%b9%e5%bc%8f.html" title="OLAP中的AverageOfChildren聚合方式 (2009/08/10)">OLAP中的AverageOfChildren聚合方式</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/ssas%e5%a4%84%e7%90%86%e6%97%b6%e6%89%be%e4%b8%8d%e5%88%b0%e5%b1%9e%e6%80%a7%e9%94%ae%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95.html" title="SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法 (2010/07/19)">SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/10/%e5%85%a8%e5%8d%8a%e8%a7%92%e7%a9%ba%e6%a0%bc%e5%af%bc%e8%87%b4%e7%9a%84analysis-service%e5%a4%84%e7%90%86%e9%94%99%e8%af%af.html" title="全半角空格导致的Analysis Services处理错误 (2009/10/09)">全半角空格导致的Analysis Services处理错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e6%9d%83%e9%99%90%e5%af%bc%e8%87%b4%e7%9a%84analysis%e6%80%a7%e8%83%bd%e8%ae%a1%e6%95%b0%e5%99%a8%e5%9c%a8vistawin2008%e4%b8%8b%e5%a4%b1%e6%95%88%e7%9a%84%e9%97%ae%e9%a2%98.html" title="权限不足导致的Analysis性能计数器在Vista/win2008下失效的问题 (2009/11/12)">权限不足导致的Analysis性能计数器在Vista/win2008下失效的问题</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Google Analytics中的Page维度</title>
		<link>http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html</link>
		<comments>http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html#comments</comments>
		<pubDate>Sun, 03 Jan 2010 18:08:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[WebAnalytics]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[维度]]></category>
		<category><![CDATA[高级群体]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html</guid>
		<description><![CDATA[<p>Google Analytics中的Page维度非常奇怪，在不同场合中使用的时候有不同的意思。</p>
<p>为了说明这个区别，我引用之前一篇文章《<a title="Google Analytics中的UniquePageView和Visit的区别" href="http://www.imkevinyang.com/2009/12/google-analytics%e4%b8%ad%e7%9a%84uniquepageview%e5%92%8cvisits%e7%9a%84%e5%8c%ba%e5%88%ab.html" target="_blank">Google Analytics中的UniquePageView和Visit的区别</a>》中的实验数据。</p>
实验步骤
<p>我在自己的网站上放了三个很特殊的静态页面，并加上了ga的代码，这样&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Google Analytics中的Page维度非常奇怪，在不同场合中使用的时候有不同的意思。</p>
<p>为了说明这个区别，我引用之前一篇文章《<a title="Google Analytics中的UniquePageView和Visit的区别" href="http://www.imkevinyang.com/2009/12/google-analytics%e4%b8%ad%e7%9a%84uniquepageview%e5%92%8cvisits%e7%9a%84%e5%8c%ba%e5%88%ab.html" target="_blank">Google Analytics中的UniquePageView和Visit的区别</a>》中的实验数据。</p>
<h2>实验步骤</h2>
<p>我在自己的网站上放了三个很特殊的静态页面，并加上了ga的代码，这样可以排除其他不必要的干扰。</p>
<ul>
<li>gatestpage_a.html </li>
<li>gatestpage_b.html </li>
<li>gatestpage_c.html </li>
</ul>
<p>实验的几点说明：</p>
<ul>
<li>为了模拟不同用户访问我的网站，我会清除掉所有的Cookie </li>
<li>为了模拟同个用户的不同会话，我会重启浏览器 </li>
<li>为了保证数据能够成功发送到Google服务器，我使用HTTP Watch来监视所有发送的数据 </li>
</ul>
<p>测试访问记录（测试时间2009-12-06 21:40）：</p>
<ul>
<li>用户A&#160; 会话1&#160; <font color="#ff0000">gatestpage_a.html</font>&#160; </li>
<li>用户A&#160; 会话1&#160; <font color="#008000">gatestpage_b.html</font>&#160; </li>
<li>用户A&#160; 会话1&#160; <font color="#008000">gatestpage_b.html</font> </li>
<li>用户A&#160; 会话1&#160; <font color="#0000ff">gatestpage_c.html</font>&#160; </li>
<li>用户A&#160; 会话2&#160; <font color="#ff0000">gatestpage_a.html</font>&#160; </li>
<li>用户A&#160; 会话2&#160; <font color="#0000ff">gatestpage_c.html</font>&#160; </li>
<li>用户B&#160; 会话3&#160; <font color="#ff0000">gatestpage_a.html</font> </li>
<li>用户B&#160; 会话3&#160; <font color="#ff0000">gatestpage_a.html</font>&#160;&#160; </li>
<li>用户C&#160; 会话4&#160; <font color="#ff0000">gatestpage_a.html</font>&#160; </li>
<li>用户C&#160; 会话4&#160; <font color="#008000">gatestpage_b.html</font> </li>
<li>用户C&#160; 会话5&#160; <font color="#0000ff">gatestpage_c.html</font> </li>
</ul>
<h2>报表观察</h2>
<h3>热门内容（Top Content）报表中的Page维度</h3>
<p>我们先来看热门内容报表中用到的Page维度。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb18.png" width="244" height="135" /> </p>
<p>从上面的报表中的pageview数据来看，这里的页面应该指的是所有页面的访问情况。PageView指的是页面被访问的次数，包括重复访问，而UniquePageView则剔除了重复访问的成分，一次会话只计一次，这和Visit的定义是一样的。</p>
<h3>自定义报表（Custom Reporting）中的Page维度</h3>
<p>上面的热门内容报表中的指标是针对单个页面的，如果我们从Page维度来看访问量（Visit）指标，结果又是怎样呢？为此，我创建了一个自定义报表。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb19.png" width="244" height="128" /> </p>
<p>非常简单，只有一个维度和一个指标。报表汇总结果如下：</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb20.png" width="481" height="101" /> </p>
<p>我们可以看到，这里只列出了两个页面，gatestpage_a.html和gatestpage_c.html。这两个页面有什么特别的呢？我们回去看一下实验的步骤，发现，这两个页面均是曾经“担任”过着陆页面的角色。也就是说，在这里，我们报表中选择的“页面维度”不是列出所有页面，而是列出所有着陆页面。后面的visit指标则代表着某个页面作为着陆页面的会话数。</p>
<h3>高级群体中的Page维度</h3>
<p>在高级群体中，也有一个Page维度，这又是代表什么意思呢？是所有页面还是着陆页面呢？还是其他？为此我创建了一个高级群体，仅包含一个条件，Page精确匹配/gatestpage_b.html。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb21.png" width="299" height="64" /> </p>
<p>我们回到热门内容报表中，应用此高级群体。理所当然的我们可能会认为报表中只会列出b页面的数据。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb22.png" width="244" height="176" /> </p>
<p>但是我们看到，报表并不是只列出了b页面的数据，其他页面的数据也有，只不过发生了一些差异。我们回过头去对比一下这里的数据和上面写的实验步骤，我们就可以得出结论，这时候看的内容，<strong><font color="#008000">其实是b页面和b页面相关页面的报表</font></strong>。</p>
<p>如果用户没看过或者不理解我之前<a title="Google Analytics中的UniquePageView和Visit的区别" href="http://www.imkevinyang.com/2009/12/google-analytics%e4%b8%ad%e7%9a%84uniquepageview%e5%92%8cvisits%e7%9a%84%e5%8c%ba%e5%88%ab.html" target="_blank">文章</a>中提到的高级群体的过滤方式的话，那么可能不会容易理解这里看到的数据。</p>
<p>我们再将此高级群体应用在之前创建的自定义报表上面：</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/01/image_thumb23.png" width="418" height="71" /> </p>
<p>我们看到，报表中只列出了gatestpage_a.html页面，visits数据为2。对比实验步骤，我们就知道，这里看的内容，是<strong><font color="#008000">访问过b页面的所有会话的着陆页面报表</font></strong>。</p>
<p>也就是说，在高级群体这里的“页面维度”，实际上也是代表“所有页面”的意思。</p>
<p>希望此文章能够帮你更好的理解Google Analytics工具。</p>
<p align="right">——<a href="http://www.imkevinyang.com/"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/google-analytics" title="Google Analytics" rel="tag">Google Analytics</a>, <a href="http://www.imkevinyang.com/tags/page" title="Page" rel="tag">Page</a>, <a href="http://www.imkevinyang.com/categories/techarticles/webanalytics" title="WebAnalytics" rel="tag">WebAnalytics</a>, <a href="http://www.imkevinyang.com/tags/%e7%bb%b4%e5%ba%a6" title="维度" rel="tag">维度</a>, <a href="http://www.imkevinyang.com/tags/%e9%ab%98%e7%ba%a7%e7%be%a4%e4%bd%93" title="高级群体" rel="tag">高级群体</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html" title="Analysis Services：你应该使用多对多维度吗？ (2010/04/12)">Analysis Services：你应该使用多对多维度吗？</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html" title="BIDS对于维度属性键为可变长列时存在的Bug (2009/03/22)">BIDS对于维度属性键为可变长列时存在的Bug</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/document-referrer%e4%b8%a2%e5%a4%b1%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%9f%e5%9b%a0.html" title="Document.Referrer丢失的几个原因 (2010/01/18)">Document.Referrer丢失的几个原因</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html" title="当Google Analytics、Firefox和IIS走到了一起&#8230; (2010/05/29)">当Google Analytics、Firefox和IIS走到了一起&#8230;</a> </li>
	<li><a href="http://www.imkevinyang.com/2011/01/%e7%9b%98%e7%82%b9%e5%9b%bd%e5%86%85%e5%a4%96%e4%b8%8d%e5%90%8c%e7%89%b9%e8%89%b2%e7%9a%84web%e6%b5%81%e9%87%8f%e5%88%86%e6%9e%90%e5%b7%a5%e5%85%b7.html" title="盘点国内外不同特色的Web流量分析工具 (2011/01/14)">盘点国内外不同特色的Web流量分析工具</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/09/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html" title="解决维度成员中的非法Xml字符导致的查询错误 (2009/09/19)">解决维度成员中的非法Xml字符导致的查询错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/%e9%ab%98%e6%95%88%e4%bd%bf%e7%94%a8google-analytics%e8%bf%9b%e8%a1%8cweb%e6%b5%81%e9%87%8f%e5%88%86%e6%9e%90.html" title="高效使用Google Analytics进行Web流量分析 (2010/01/02)">高效使用Google Analytics进行Web流量分析</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>解决维度成员中的非法Xml字符导致的查询错误</title>
		<link>http://www.imkevinyang.com/2009/09/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html</link>
		<comments>http://www.imkevinyang.com/2009/09/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html#comments</comments>
		<pubDate>Sat, 19 Sep 2009 15:29:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[BI/数据库]]></category>
		<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[Mdx]]></category>
		<category><![CDATA[异常]]></category>
		<category><![CDATA[维度]]></category>
		<category><![CDATA[非法Xml字符]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2009/10/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html</guid>
		<description><![CDATA[<p><font color="#ff0000">update(2009-09-20): 增加了去除这些非法Xml字符的正则表达式以及C#代码。</font></p>
问题描述
<p>最近在项目中遇到这么个情况，在展开维度成员的时候，服务端抛出了“The server sent an unrecognizable response”的异常，看了下异常细节，给出的信息是“'', hexadeci&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p><font color="#ff0000">update(2009-09-20): 增加了去除这些非法Xml字符的正则表达式以及C#代码。</font></p>
<h2>问题描述</h2>
<p>最近在项目中遇到这么个情况，在展开维度成员的时候，服务端抛出了“The server sent an unrecognizable response”的异常，看了下异常细节，给出的信息是“'', hexadecimal value 0x01, is an invalid character. Line 1, position 6771. (System.Xml) ”。</p>
<h2>问题解决</h2>
<p>出现这样问题的原因在于，微软的Analysis Service使用XMLA（XML for Analysis）语言和其他客户端进行交互，包括执行Mdx、DMX、Sql等。<strong><font color="#008000">如果服务端返回的成员（关键列、名字、标题、成员值等）含有一些非打印字符的话，那么就无法直接在Xml中表示，这样就会导致客户端无法解析返回的Xml响应，而出现上述的错误</font></strong>。</p>
<p>Analysis Service在Process的时候，出于性能考虑默认情况下是不会对数据进行这种Xml非法字符的检测。不过Analysis Service也提供了一个设置开关，允许我们在处理阶段检测这些非法字符，并做一定的规范化处理。在BIDS中，我们打开维度属性的属性面板，有一个InvalidXmlCharacters的设置，如下图所示：</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="InvalidXmlCharacters设置" border="0" alt="InvalidXmlCharacters设置" src="http://www.imkevinyang.com/wp-content/uploads/2009/10/image_thumb.png" width="218" height="168" /> </p>
<p><strong><font color="#008000">默认情况下其值为Preserve，也就是保留这些非法字符。它还有其他两个选项。Remove表示移除这些非法字符，只保留合法的Xml字符。Replace表示使用问号?替换非法字符，一个非法字符对应一个问号</font></strong>。在实际应用中，InvalidXmlCharacters需要根据项目的实际情况进行设置。如果对数据的这种清理可以放到ETL阶段，那么最好放到ETL阶段，因为这样可以加快Analysis Service处理的速度。否则就只能在Process的时候做检测了。对于Remove和Replace，我比较倾向于选择Remove。因为既然已经是非打印字符了，用问号代替固然能够和其他数据区分开来，但是对于最终用户来说，大部分情况下只会增加他们的迷惑而已。</p>
<h2>剔除非法Xml字符</h2>
<p>在<a title="Xml 1.0规范" href="http://www.w3.org/TR/REC-xml/#NT-Char" target="_blank">Xml 1.0规范</a>（第五版，06/11/2008）的2.2一节中提到了Xml合法字符的范围：</p>
<blockquote><p><i>/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */</i></p>
<p><code>Char</code> ::=&#160;&#160; <code>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]</code>       </p>
</blockquote>
<p>规范中建议，所有Xml处理器都应该正确处理上述范围的这些字符。</p>
<p>我们可以在处理字符串的时候使用正则表达式剔除掉非法的Xml字符，以保证最终进入Analysis Service的字符都是Xml合法字符。</p>
<pre class="csharpcode">[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]</pre>
<p>对应的C#代码如下，出于性能考虑，可以将函数内部的正则表达式存储为成员变量，并设置为预编译模式。</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> String StripInvalidXmlChars(String input)
{
  Regex re = <span class="kwrd">new</span> Regex(<span class="str">@&quot;[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]&quot;</span>);
  <span class="kwrd">return</span> re.Replace(input, <span class="str">&quot;&quot;</span>);
}</pre>
<p>&#160;</p>
<p>参考文档：</p>
<p><a href="http://cse-mjmcl.cse.bris.ac.uk/blog/2007/02/14/1171465494443.html" rel="nofollow">Invalid XML Characters: when valid UTF8 does not mean valid XML</a></p>
<p><a title="unprintable characters in member names cause error" href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=264939" rel="nofollow" target="_blank">unprintable characters in member names cause error</a></p>
<p><a title="Xml 1.0规范" href="http://www.w3.org/TR/REC-xml/#NT-Char" target="_blank">Xml 1.0规范</a></p>
<p align="right">——<a href="http://www.imkevinyang.com/"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/analysis-services" title="Analysis Services" rel="tag">Analysis Services</a>, <a href="http://www.imkevinyang.com/categories/techarticles/businessintelligence" title="BI/数据库" rel="tag">BI/数据库</a>, <a href="http://www.imkevinyang.com/tags/mdx" title="Mdx" rel="tag">Mdx</a>, <a href="http://www.imkevinyang.com/tags/%e5%bc%82%e5%b8%b8" title="异常" rel="tag">异常</a>, <a href="http://www.imkevinyang.com/tags/%e7%bb%b4%e5%ba%a6" title="维度" rel="tag">维度</a>, <a href="http://www.imkevinyang.com/tags/%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6" title="非法Xml字符" rel="tag">非法Xml字符</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html" title="64位系统下IIS7 ISAPI处理器加载失败 (2010/05/05)">64位系统下IIS7 ISAPI处理器加载失败</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/04/analysis-services-2005-olap%e8%ae%be%e8%ae%a1%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5.html" title="Analysis Services 2005 OLAP设计最佳实践 (2009/04/02)">Analysis Services 2005 OLAP设计最佳实践</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html" title="Analysis Services：你应该使用多对多维度吗？ (2010/04/12)">Analysis Services：你应该使用多对多维度吗？</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html" title="BIDS对于维度属性键为可变长列时存在的Bug (2009/03/22)">BIDS对于维度属性键为可变长列时存在的Bug</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e9%83%a8%e7%bd%b2%e6%97%b6%e5%87%ba%e7%8e%b0%e5%85%83%e6%95%b0%e6%8d%ae%e7%ae%a1%e7%90%86%e5%99%a8%e5%8f%91%e7%94%9f%e9%94%99%e8%af%af.html" title="BIDS部署时出现元数据管理器发生错误 (2009/03/13)">BIDS部署时出现元数据管理器发生错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html" title="Google Analytics中的Page维度 (2010/01/04)">Google Analytics中的Page维度</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/05/javascript%e4%b8%ad%e8%8e%b7%e5%8f%96%e5%87%ba%e9%94%99%e4%bb%a3%e7%a0%81%e6%89%80%e5%9c%a8%e6%96%87%e4%bb%b6%e5%8f%8a%e8%a1%8c%e6%95%b0.html" title="Javascript中获取出错代码所在文件及行数 (2009/05/18)">Javascript中获取出错代码所在文件及行数</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/08/olap%e4%b8%ad%e7%9a%84averageofchildren%e8%81%9a%e5%90%88%e6%96%b9%e5%bc%8f.html" title="OLAP中的AverageOfChildren聚合方式 (2009/08/10)">OLAP中的AverageOfChildren聚合方式</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/ssas%e5%a4%84%e7%90%86%e6%97%b6%e6%89%be%e4%b8%8d%e5%88%b0%e5%b1%9e%e6%80%a7%e9%94%ae%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95.html" title="SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法 (2010/07/19)">SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/09/visual-studio%e5%b0%8f%e8%b4%b4%e5%a3%ab%e5%8a%a0%e4%ba%86try-catch%e4%b9%9f%e8%83%bd%e8%87%aa%e5%8a%a8%e5%ae%9a%e4%bd%8d%e5%88%b0%e5%bc%82%e5%b8%b8%e4%bb%a3%e7%a0%81.html" title="Visual Studio小贴士&mdash;&mdash;加了Try-Catch也能自动定位到异常代码 (2009/09/18)">Visual Studio小贴士&mdash;&mdash;加了Try-Catch也能自动定位到异常代码</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2009/09/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BIDS对于维度属性键为可变长列时存在的Bug</title>
		<link>http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html</link>
		<comments>http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html#comments</comments>
		<pubDate>Sun, 22 Mar 2009 10:26:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[BI/数据库]]></category>
		<category><![CDATA[技术随笔]]></category>
		<category><![CDATA[BIDS]]></category>
		<category><![CDATA[可变长列]]></category>
		<category><![CDATA[属性键]]></category>
		<category><![CDATA[操作已取消]]></category>
		<category><![CDATA[维度]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html</guid>
		<description><![CDATA[<p>一个非常简单的维度表，结果部署上去之后总是无法浏览，一点开Key属性层次时总提示“操作已取消”，“处理时发生错误”等等的无用提示信息。</p>
<p>后来使用排除法发现，在出问题的维度中只留下一个Key属性时就没有问题了，然后我再将数据仓库中该维度表的各个列逐个添加到此维度中去，发现当添加了存放Url的可变长列（N&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>一个非常简单的维度表，结果部署上去之后总是无法浏览，一点开Key属性层次时总提示“操作已取消”，“处理时发生错误”等等的无用提示信息。</p>
<p>后来使用排除法发现，在出问题的维度中只留下一个Key属性时就没有问题了，然后我再将数据仓库中该维度表的各个列逐个添加到此维度中去，发现当添加了存放Url的可变长列（NVarchar，2048）时就会出错。检查了一下该维度属性的KeyColumns设置，发现上面属性键确实是设置对了，但是该键的DataSize值确实1024。</p>
<p>猜想可能这是BIDS的一个bug吧。</p>

	标签：<a href="http://www.imkevinyang.com/categories/techarticles/businessintelligence" title="BI/数据库" rel="tag">BI/数据库</a>, <a href="http://www.imkevinyang.com/tags/bids" title="BIDS" rel="tag">BIDS</a>, <a href="http://www.imkevinyang.com/tags/%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97" title="可变长列" rel="tag">可变长列</a>, <a href="http://www.imkevinyang.com/tags/%e5%b1%9e%e6%80%a7%e9%94%ae" title="属性键" rel="tag">属性键</a>, <a href="http://www.imkevinyang.com/categories/techarticles" title="技术随笔" rel="tag">技术随笔</a>, <a href="http://www.imkevinyang.com/tags/%e6%93%8d%e4%bd%9c%e5%b7%b2%e5%8f%96%e6%b6%88" title="操作已取消" rel="tag">操作已取消</a>, <a href="http://www.imkevinyang.com/tags/%e7%bb%b4%e5%ba%a6" title="维度" rel="tag">维度</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/04/analysis-services-2005-olap%e8%ae%be%e8%ae%a1%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5.html" title="Analysis Services 2005 OLAP设计最佳实践 (2009/04/02)">Analysis Services 2005 OLAP设计最佳实践</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html" title="Analysis Services：你应该使用多对多维度吗？ (2010/04/12)">Analysis Services：你应该使用多对多维度吗？</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e9%83%a8%e7%bd%b2%e6%97%b6%e5%87%ba%e7%8e%b0%e5%85%83%e6%95%b0%e6%8d%ae%e7%ae%a1%e7%90%86%e5%99%a8%e5%8f%91%e7%94%9f%e9%94%99%e8%af%af.html" title="BIDS部署时出现元数据管理器发生错误 (2009/03/13)">BIDS部署时出现元数据管理器发生错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html" title="Google Analytics中的Page维度 (2010/01/04)">Google Analytics中的Page维度</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/ssas%e5%a4%84%e7%90%86%e6%97%b6%e6%89%be%e4%b8%8d%e5%88%b0%e5%b1%9e%e6%80%a7%e9%94%ae%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95.html" title="SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法 (2010/07/19)">SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/09/%e8%a7%a3%e5%86%b3%e7%bb%b4%e5%ba%a6%e6%88%90%e5%91%98%e4%b8%ad%e7%9a%84%e9%9d%9e%e6%b3%95xml%e5%ad%97%e7%ac%a6%e5%af%bc%e8%87%b4%e7%9a%84%e6%9f%a5%e8%af%a2%e9%94%99%e8%af%af-2.html" title="解决维度成员中的非法Xml字符导致的查询错误 (2009/09/19)">解决维度成员中的非法Xml字符导致的查询错误</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2009/03/bids%e5%af%b9%e4%ba%8e%e7%bb%b4%e5%ba%a6%e5%b1%9e%e6%80%a7%e9%94%ae%e4%b8%ba%e5%8f%af%e5%8f%98%e9%95%bf%e5%88%97%e6%97%b6%e5%ad%98%e5%9c%a8%e7%9a%84bug.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.imkevinyang.com @ 2012-02-08 19:09:15 -->
