当前位置:首页 > 办公设计 > Office教程 > 数据集函数Part1 概述(二)

数据集函数Part1 概述(二)

7小时前Office教程70

译者:apolloh  来源:http://blogs.msdn.com/excel
发表于:2006年7月7日

What are the new CUBE functions?

新增的数据集函数是什么?

We have implemented seven new CUBE functions that can be used in Excel formulas just like any other function in Excel. These functions permit Excel to fetch data from SQL Server Analysis Services (2000 & 2005), including any member, set, aggregated value, property, or KPI (Key Performance Indicator) from the OLAP cube. This data can then be placed anywhere in the spreadsheet, intermingled with other local calculations and/or within other formulas. Here are the seven new CUBE functions:
我们补充了7个新数据集函数,同其它工作表函数一样,可以在Excel公式中使用。这些函数允许Excel从 SQL Server Analysis Services (2000 & 2005) 提取数据,包括任意成员、子集、汇总值、属性或KPI(关键业绩指标)。这些数据可以放在电子表格的任何地方参与本地计算,或者作为其他公式的一部份参与计算。

CUBEMEMBER (connection, member_expression,)
This function will fetch the member or tuple defined by the member_expression. For example, (from the illustration above,) the formula: =CUBEMEMBER (“Adventure Works”, “[Sales Reason].[On Promotion]”) returns the member named “On Promotion” from the “Sales Reason” dimension of the Adventure Works cube.

该函数通过定义member_expression(成员表达式)提取成员或成员组。例如,上个实例的公式=CUBEMEMBER (“Adventure Works”, “[Sales Reason].[On Promotion]”), 从Adventure Works 数据集的“销售成因”维度返回了一个“促销”成员。

CUBEVALUE (connection, [member_expression_1], [member_expression_2], …)
This function will fetch the aggregated value from the cube filtered by the various member_expression arguments. For example, the formula: =CUBEVALUE (“Adventure Works”,”[Measures].[Gross Profit]”,”[Product].[Category].[Bikes]”,”[Date].[Fiscal Year].[FY 2004]”) returns the value $5,035,271.22 which is the aggregated amount in the Adventure Works cube for Gross Profit for Bikes in Fiscal 2004.

该函数对数据集按member_expression(成员表达式)参数变量汇总,返回汇总数。例如,公式=CUBEVALUE (“Adventure Works”,”[Measures].[Gross Profit]”,”[Product].[Category].[Bikes]”,”[Date].[Fiscal Year].[FY 2004]”) ,返回Adventure Works数据集中2004财政年度自行车的销售毛利的汇总金额$5,035,271.22

CUBESET (connection, set_expression, , [sort_order], [sort_by])
This function will fetch the set that is defined by the set_expression parameter. Optional parameters allow you to specify the ordering of the set as well as the caption to be displayed in the Excel cell that contains this formula. (Note that the set itself won’t have a display value. For example, the formula: =CUBESET (“Adventure Works”,”[Customer].[Customer Geography].[All Customers].children”,”Countries”) returns the set of countries in the Customer Geography hierarchy and shows “Countries” as the cell’s display value.

该函数通过set_expression(子集表达式)参数的定义提取子集。选项参数Caption可用来自定义一个子集的标题,显示在包含该公式的单元格中。(注意子集本身并不显示值) 例如,公式=CUBESET (“Adventure Works”,”[Customer].[Customer Geography].[All Customers].children”,”Countries”)分级返回Customer Geography的国家名子集,并显示“国家”作为单元格的值。

CUBESETCOUNT (set)
This function returns the number of items in a set. Typically the argument to this
function will be a CUBESET function or a reference to a CUBESET function.

该函数返回一个子集的记录数,其参数是一个数据子集函数或子集函数所在单元格的引用。

CUBERANKEDMEMBER (connection, set_expression, rank, )
This function returns the Nth item from a set. This can be very useful when building a Top N (or Bottom N) report in Excel.

该函数返回子集的前N名的记录。当用Excel建立一个前N或后N名的报告时,它会很有用。

CUBEMEMBERPROPERTY (connection, member_expression, property)
This function returns a property of a member in the OLAP cube.

该函数返回OLAP数据集中某个成员的属性。

CUBEKPIMEMBER (connection, kpi_name, kpi_property, )
This function returns a KPI (Key Performance Indicator) from the OLAP cube.

该函数从OLAP数据集返回一个KPI(关键业绩指标)

CUBE functions provide MDX to other CUBE functions
There is one way in which the CUBE functions are significantly different from any other Excel functions. This is in the way that they behave when they are passed in as arguments to other CUBE functions.

数据集函数与其他Excel函数相比,有个很大的不同点——当它们作为其他数据集函数的参数时,有不同的行为表现。

Functions that are not CUBE functions return a value which is displayed in the Excel spreadsheet cell. For example, the result of a SUM function will be a number that is displayed in the cell.
非数据集函数返回值直接显示在Excel中。例如,SUM函数会显示一个数值在单元格中。

CUBE functions (except for CUBESETCOUNT) return a result which is more complex than this. CUBE functions return two distinct values. One is the value that is displayed in the cell. But there is also a second hidden value which can be thought of as an MDX expression (MDX is the Multi-Dimensional eXpression language used by SQL Server Analysis Services) defining the result. When one CUBE function uses another CUBE function as its argument, the argument takes on the MDX value rather than the display value.
数据集函数(除了CUBESETCOUNT 外)的返回值要复杂许多。除了一个值显示在单元格中,还有第二个隐藏值,可以看作是MDX表达式(SQL Server Analysis Services使用的多维表达式语言)的结果。当一个数据聚集函数使用另一个数据集函数作为参数时,该参数取MDX值,而不是显示值。

Here’s an illustration that I hope will help to make this clearer. Here is the asymmetric report that we looked at earlier.
我希望通过一个例子来更清楚地说明这个概念。还是刚才我们看到的那个例子。

 

Cell C2 actually contains two separate values. The first is the display value that you see in the cell, namely “On Promotion”. But when the formula in cell C3 uses cell C2 as an argument, the value that it obtains from cell C2 is actually “[Sales Reason].[Sales Reasons].[Sales Reason].&[2]” which is the MDX unique name for the “On Promotion” member. You can find this hidden value behind the CUBE function using Excel’s object model by selecting cell C2 and then typing “?Activecell.MDX” into the immediate window in the Visual Basic Editor.
单元格C2实际包含两个不同的值。第一个显示在单元格中——“促销”。单元格C3使用了C2为参数,而其所使用的值实际上是“[Sales Reason].[Sales Reasons].[Sales Reason].&[2]” ,是MDX返回的该“促销”成员的唯一值。您可以使用Excel对象模式选择C2单元格,然后在VBE立即窗口输入“?Activecell.MDX”,找到藏在数据集函数中的隐藏值。

And that’s the overview. In my next post, I will provide some examples that illustrate how to use these functions in your reports.
以上是数据集函数的概述。下篇帖子,我将用些示例来说明怎样在报表中使用这些函数。

Published Thursday, February 02, 2006 8:59 PM by David Gainer
Filed Under: Formulas and functions, Analysis Services

注:本文翻译自http://blogs.msdn.com/excel ,原文作者为David Gainer(a Microsoft employee),Excel Home 授权转载。严禁任何人以任何形式转载,违者必究。

扫描二维码推送至手机访问。

欢迎转载或分享本篇文章。

本文链接:https://www.jcba123.com/article/1078

分享给朋友:

“数据集函数Part1 概述(二)” 的相关文章

Excel倒计时功能公式计算剩余的天数、时间和秒数

Excel倒计时功能公式计算剩余的天数、时间和秒数

时间对我们每个人都很重要。我们总是着眼于当前时间,为下一秒钟做好适当的安排。浪费时间就是浪费生命,所以时间的重要性不言而喻。我们经常数下一些重要的日子,为重要时刻的到来做准备。在这里,小王老师将与您分享一些Excel倒计时的功能公式,它可以随时提醒您预设日期的到来。 1.倒计时日 在这里,...

Excel常用函数公式20例

Excel常用函数公式20例

下面是一组常用Excel函数公式的用法,学会这些套路,让工作效率再高一丢丢。 1、IF函数条件判断 IF函数是最常用的判断类函数之一,能完成非此即彼的判断。 如下图,考核得分的标准为9分,要判断B列的考核成绩是否合格。 =IF(B4>=9,”合格”,”不合格”) IF,相当于普通...

用Excel要学会偷懒,懒人必备Excel技巧

用Excel要学会偷懒,懒人必备Excel技巧

人还是要学会偷懒,人类在偷懒的同时,也发明了不少高科技,啥汽车、飞机、洗衣机等。在用Excel的处理表格数据时,我们同样也要学会偷懒,但是,前提是你要掌握一些能够用来偷懒的技巧。   1、将数据复制到多个工作表 有时候,我们希望将数据复制到其他的工作表中,我们可以先选中多个工作表...

划重点,一组常用且实用的Excel技巧

划重点,一组常用且实用的Excel技巧

1、快速调整数据位置 已经录入数据的表格,要调整某一列的位置怎么办? 只要选中要调整的数据区域,然后按住Shift键不放,光标放到绿色边框位置后,按下鼠标左键不放拖动即可:   2、填充合并单元格 对已有合并单元格的工作表,如何快速整理呢? 其实很简单:选中数据区域,先...

按部门统计男女比例,方法比拼

按部门统计男女比例,方法比拼

先来看数据源,是各部门的员工花名册,需要按部门统计男女比例:   文艺青年: 先复制A列的部门,粘贴到空白单元格区域,然后使用【数据】选项卡下的【删除重复项】功能,来获取部门清单。 在H1和I1单元格分别输入“男”、“女”。 在H2单元格输入以下公式,向右向下复制公式。 =COUNTI...

PPT如何制作3D轮廓发光字

PPT如何制作3D轮廓发光字

第一步:打开PPT软件,创建一个新的空白演示文稿。您可以选择一种颜色来填充背景。然后,插入一个文本框,并输入所需的文字。选中文本框并右击,在弹出的快捷方式中选择"设置形状格式"选项。在打开的"设置形状格式"窗格中,单击"文本选项"下的"文本填充与轮廓"图标。将"文本填充"设置为"无填充",将...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。