IBM Cognos 8 维度函数参考指南_第1页
IBM Cognos 8 维度函数参考指南_第2页
IBM Cognos 8 维度函数参考指南_第3页
IBM Cognos 8 维度函数参考指南_第4页
IBM Cognos 8 维度函数参考指南_第5页
已阅读5页,还剩25页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1简介1.1目的本文档提供了有关ReportStudioforIBMCognos8中的维度函数(dimensionalfunction)的详细内容和示例。适用范围本文档列出的技巧和产品行为适用于:IBMCognos6-0,使用来自样例的IBMCognosGreatOutdoorSales(多维数据集)。回页首2背景资料下图是著名户外品牌PowerCube公司的产品空间的示例结构,展示了CampingEquipmentProductLine的产品成员。这个产品空间将作为许多后续示例的基础。一jripiriijEg11r-F?!iABvLineF-&dLJlTtrsIClidWAtetBMI曲匸:

2、卜品Ccjnl-rafn、TcntS.SkinpmgP3i*Lb讨im-Wccxfe厂PtJI-rtaiGE?Ajem壮Dries*轴sgtwJAx亡史轴立注骨0uLdatMFrtrbttchoinTTK对四DduxJM弘口1田F*曲/rrdiChCaLlbleFlwuT-*IChtfir-fliX/珅刖*rjBriwgAcce&?.-*r*ETocfcHufikRopeEBHuikp戌*1闔冲teiky国诃#yiKiTTUciF-rhcoKl回页首3函数定义ancestor语法:ancestor(member,level|integer)描述:返回指定成员的位于指定(指定名称)级别的祖先,或

3、者返回位于该成员指定数量的级别之上的祖先。注意:在存在多个祖先的情况下不能保证结果的一致性。示例:ancestor(TrailChefWaterBag,1)结果:CookingGearancestor(TrailChefWaterBag,2)结果:CampingEquipmentancestor(TrailChefWaterBag,great_outdoors_company.Products.Products.Producttype)结果:CookingGearancestors语法:ancestors(member,level|integer)描述:返回一个成员的位于指定级别的所有祖先,或

4、者是与该成员具有指定距离的所有祖先。(大多数数据源支持一个特定级别只有一个祖先,但是有些数据源支持多个祖先。因此结果是一个成员集)示例:ancestors(TrailChefWaterBag,1)结果:CookingGearancestors(TrailChefWaterBag,2)结果:CampingEquipmentancestors(TrailChefWaterBag,great_outdoors_company.Products.Products.Producttype)结果:CookingGearbottomCount语法:bottomcount(set_exp,index_exp,

5、numeric_exp)描述:该函数根据numeric_expression对每个set_exp成员计算的值对集合排序,并返回最底部的index_exp成员。示例:根据使用2006交集(intersection)和默认度量Revenue的交叉表报表确定numeric_exp。bottomCount(set(CampingEquipment,GolfEquipment,MountaineeringEquipment),2,2006)JftpngquJprwnt-irc&dfEquiprfisrt-rEqu!pmerFt4r“曲MAVJf1前斗52322M曲“佃钟AMatMF攀團aim/arftp

6、lngWquipmanliSolFEqulprrr#M-auralnssriftgEquipment:2001J2047132f.88阳冏加80$0.003OD5駕网m別131,973.46、久葩巳丽aeaf9,42,574.Ei2006打左锯托菇,X37,6055,510#0j5.&r车口,21676.oebottomSum语法:bottomsum(set_exp,numeric_exp1,numeric_exp2)描述:该函数将对numeric_exp2排序(后者对相应的set_exp成员进行计算),并选择其累计总数至少为“numeric_expl的最底层的元素。示例:RtfYKTIUCn

7、jEwpTKnt*?:、#两;-jntiritvririflEquinsnfe#1234*U曽沪!12344A=:Sl?34f基于一个交叉表报表bottomSum(members(great_outdoors_company.Products.Products.Productline),6000000,tuple(2006,great_outdoors_company.Measures.Grossprofit)结果:庫鬥.ilWfltrf油聊PEE*CarcarqEiugrtGotEqjpwitNouriarwfhcEch树Bnt2004JliiK诲”片沁罷s阴gMEH).如佩咽站.列帆炳.题

8、S3口1,773上DMG丽強沁gg20打科EH归fl陀曳訶宴翻13隔也55關$10.70914訂l,2*8”测6僚caption语法:caption(level|member|set_exp)描述:返回指定元素的标题值。标题是元素的字符串显示名,并且不需要匹配用于生成元素的业务键或惟一成员名的惟一标识符。标题不需要具有惟一性。月份的标题可能会返回月份名,而不会返回限定这一个值的年份信息。示例:caption(TrailChefWaterBag)结果:TrailChefWaterBagcaption(great_outdoors_company.Products.Products.Product

9、line)结果:CampingEquipmentMountaineeringEquipmentPersonalAccessoriesOutdoorProtectionGolfEquipmentchildren语法:children(member)描述:返回指定成员的子集合。示例:children(CampingEquipment)结果:CookingGearTentsSleepingBagsPacksLanternsclosingPeriod语法:closingperiod(level,member)描述:返回位于某个指定级别的成员的后代中的最后一个兄弟节点。通常与时间维度结合使用示例:clo

10、singPeriod(great_outdoors_company.Years.Years.Month)结果:2006/DecclosingPeriod(great_outdoors_company.Years.Years.Year)结果:2006closingPeriod(great_outdoors_company.Years.Years.Month,2006Q4)结果:2006/DeccompleteTuple语法:completeTuple(member,member)描述:类似于tuple,根据指定的成员识别cell位置(交集),每个成员必须来自不同的维度。然而,completetu

11、ple隐含了来自所有维度的默认成员(没有以其他方式指定),而不是包含当前的成员。这个cell的值可以被包含到value函数中。示例:下面的第一列使用表达式:completetuple(MountaineeringEquipment,Fax)第二列使用一个更精确的表达式:completetuple(MountaineeringEquipment,Fax,Quantitysold,currentMember(great_outdoors_company.Years.Years)结果:Qu4iititysold陡匕诫恤as齿a龙內畸理知y此5byJd.faurreyrar/200420052S&6c

12、ompletetuple并没有像tuple函数那样默认选择currentMember。第一列的值对于每年都是相同的,因为使用的是Years维度的默认成员rootmember,而不是当前成员同样,第一列显示的是Revenue而不是QuantitySold,因为Revenue度量是来自Measures维度的默认值。如果completetuple函数中没有定义currentMeasure的话,Completetuple将在查询中使用默认度量而不是currentMeasure。以上输出的第二列指定completetuple函数将使用Years维度的currentMember以及Quanitytsold

13、度量。这与下面用于Tuple函数的示例相同,其中默认选择了currentMember和currentMeasure。cousin语法:cousin(memberl,member2)描述:返回成员2的子成员,该子成员在其父成员下具有与成员1相同的相对位置示例:cousin(lrons,CampingEquipment)结果:CookingGearcousin(Putters,CampingEquipment)结果:SleepingBagscurrentMember语法:currentMember(hierarchy)描述:在一次迭代期间返回层次结构中的当前成员。如果在计算表达式的上下文中没有给出

14、指定的层次结构,那么将假设一个默认成员。示例:currentMember(great_outdoors_company.Products.Products)Quantitysold抵aEI花JfProduttC#currerrthJ!=niherjncurrentrienr-berff?结果:CcirnpingEquipmentCampingEquipmentGolFEquipmentGnffEqupme-ntMountaineeringEcpjipmentMountarieeringEunpin&nt301;SOLftdDGrPrstecttcnCxjtdoorProtectiori557.

15、354Perscinl口宙吕Personal&匚已第说和es3906匚oohryGear匚ockingGear98.676SleepingBagskeepingB邓茨砂Pack;P/ks95.55ZTentsT-entsLantarnsLanterrii3096IronsIrons艸,严HPuttersftjt丽23,244WoodsWQOdS13,324GolFAMSMOri石MAttMS&rie:q7,9&B(imbing.limbingAcesnriss14Z.1&QTooisTcdIs9&.79SRapeFtcpn40,570EntitySAheiy22,332FirstAidFist

16、Aid72.34BInsectRepelantsInsectRepellents270.074GunscreenJurtscrten215,43ZBinocularsEJkiocLdars43,330NavigationNavigation56,666EywjcafEyewear53,510KnivesKnives134,1341陥密defaultMember语法:defaultMember(hierarchy)描述:返回层次结构的默认成员。示例:defaultMember(great_outdoors_company.Products.Products)结果:ProductsdefaultM

17、ember(great_outdoors_company.Years.Years)结果:YearsdefaultMember(hierarchy(great_outdoors_company.Measures.Quantitysold)结果:RevenuedruItMemberMeasures-#ftBveraueO#MemberPrrdui.tstfdeaultMemberProducts#-结果:defaMltMemberMeasuresdefsukMemberMbml:esRever:jeQujntitveq忖FacLtts$171月耳asiTiT5?&j3g?.ae2.21535+de

18、scendants语法:descendants(set_expr,level|index,self|before|beforewithmember|after)描述:返回一组成员的位于指定级别或与根具有指定距离的后代集,可以包含或排除位于其他级别的后代。将从集合中移除相同的成员。示例:注意:great_outdoors_company.Products.Products.Products是Products层次结构的根成员。descendants(Member,Level)或descendants(Member,Level,self)descendants(great_outdoors_comp

19、any.Products.Products.Products,great_outdoors_company.Products.Products.Producttype)结果:CookingGearSleepingBagsPacksTentsFirstAidInsectRepellentsSunscreenBinocularsNavigationEyewearKnivesWatchesdescendants(Member,)descendants(great_outdoors_company.Products.Products.Products,1)结果:CampingEquipmentGolf

20、EquipmentMountaineeringEquipmentOutdoorProtectionPersonalAccessoriesdescendants(Member,before)descendants(great_outdoors_company.Products.Products.Products,3,before)结果:CampingEquipmentCookingGearSleepingBagsPacksTentsLanternsGolfEquipmentIronsPuttersWoodsGolfAccessoriesMountaineeringEquipmentClimbin

21、gAccessoriesToolsRopeSafetyOutdoorProtectionFirstAidInsectRepellentsSunscreenPersonalAccessoriesBinocularsNavigationEyewearKnivesWatchesdescendants(great_outdoors_company.Products.Products.Products,2,selfbefore)CampingEquipmentCookingGearSleepingBagsPacksTentsLanternsGolfEquipmentIronsPuttersWoodsGo

22、lfAccessoriesMountaineeringEquipmentClimbingAccessoriesToolsRopeSafetyOutdoorProtectionFirstAidInsectRepellentsSunscreenPersonalAccessoriesBinocularsNavigationEyewearKnivesWatchesemptySet语法:emptySet(hierarchy)描述:返回指定层次结构的空成员集合。这通常在开发中被作为占位符使用,或者结合使用动态报表设计(利用SDK或报表设计)。通过创建包含emptyset函数的数据項,可以构建一个复杂的表达

23、式,稍后可以通过重新定义emptyset数据項来修改此表达式。示例:except(great_outdoors_company.Products.Products.Productline,emptyset(great_outdoors_company.Products.Products)结果:CampingEquipmentGolfEquipmentMountaineeringEquipmentOutdoorProtectionPersonalAccessoriesexcept语法:except(set_exp1,set_exp2,all)描述:返回set_exp1中未出现在set_exp2中

24、的成员。只有在可选的关键字ALL被作为第三个参数提供时,才会保留相同的成员。示例:except(set(CampingEquipment,MountaineeringEquipment),set(CampingEquipment,GolfEquipment)结果:MountaineeringEquipmentfilter语法:filter(set_exp,boolean_exp)描述:返回根据boolean条件对指定集合执行过滤后的结果集。当且仅当“boolean_exp”的对应值为true时才会在结果中包含每一个成员。示例:源数据:ProducNinaGrossmargin匚impingEq

25、uipment29.28%GolFEquipment斗&39%MountaineeringEquipment37.43%OutdoorProtection5S.S6%PersonalAccessories35.27%表达式:filter(Productline,Grossmargin.30)结果:Revenue2GM20052006$0.00Outdoor%啟伽須悶右0腳恥诃/foraEK屜?咖制妙52$陀炳枫04$0隔救恥源数据:YearProductlineGe莎nrrgin2006CampingEqpmentZ0D6GolfEqurpm&nt45.58%2006MountamerFngE

26、qMpm总刑36.59%2006OutdoorProtection55,50%2006Perjond34J3%表达式:filter(Productline,tuple(Grossmargin,2006).30)结果R-eyenue200420052006Outdoorflncre出mPerscnaJAccessaries3.17firstChild语法:firstchild(member)描述:返回某个成员的第一个子成员。示例:firstChild(ByProductLines)结果:CampingEquipmentfirstChild(CampingEquipment)结果:CookingG

27、earfirstSibling语法:firstSibling(member)描述:返回某成员的父成员的第一个子成员。示例:firstSibling(OutdoorProtection)结果:CampingEquipmentfirstSibling(CampingEquipment)结果:CampingEquipmentgenerate语法:generate(set_exp1,set_exp2,all)描述:该函数将针对set_exp1的每个成员计算set_exp2,并通过使用合并(union)连接结果集。如果指定了ALL,那么将在结果中保留相同的值。示例:以下示例按照收入计算了每个产品线排在前

28、两位的产品。generate(Productline,topCount(descendants(currentMember(great_outdoors_company.Products.Products),great_outdoors_company.Products.Products.Productname),2,Revenue)结果:7Revenuie仁dTiping丘口uiprnwitStarDotne148.0,60SJtarGMf5r3$13,044.951.40ijoIFEcfuipmentHailstoinlltaniuhnWoods5tt$6,2&1J17.96Hafista

29、rmSteeJWoodsSet4禹242朋Muunteine&iingEquipmentHiskfRope90D,613353.3CHuskyRoBAOf2,55977,34OutdoorPrctectlori创口号ii创dExt!匕in亡W6.71B.1B&tig5h?ldloLiarLte$a5(55,54PersoTialArcessDrhesMoirrt3inManE囲旳已,334.879,56GlacierEF5上xtrrrn亡f3j039,784,26head语法:head(set_exp,index_exp)描述:返回set_exp的第一个index_exp元素。默认index_

30、exp为1。示例:head(members(great_outdoors_company.Products.Products.Productline)结果:CampingEquipmenthead(members(great_outdoors_company.Products.Products.Productline),2)结果:CampingEquipmentMountaineeringEquipmenthierarchize语法:hierarchize(set_exp)描述:此函数对层次结构中的某个集合的成员进行排序。同一级别的成员将根据其自然顺序排序当没有指定其他排序条件时,这将作为维度

31、成员的默认排序法。示例:Revenut卅ngCqyiprwnt-F;:常駅*Equ;pmnt-r:、Mnuritilnrlnglqu胡戒带曲s弗S:PC.MEMBER.20070701-20070731,great_outdoor_sales_en.Years.Years.Month)结果:great_outdoor_sales_en.Years.Years.Month-:PC.MEMBER.20070701-200707313.33member语法:member(value_exp,string,string2,hierarchy)Amember+bMember,uniqueid,capti

32、on,hierarchy描述:根据指定层次架构中的指定表达式定义一个成员。stringl”用于识别由该函数创建的成员,它必须在查询中惟一,并且必须不同于同一个层次结构中的任何其他成员。string2用作这个成员的标题;如果没有给出的话,标题为空。如果层次结构被忽略,那么将假设一个度量维度。注意:被作为分组项(其兄弟项为其他计算或成员集)的所有计算都应当通过此函数显式分配给一个层次结构,否则结果将不可预测。惟一的例外情况就是当计算仅涉及与兄弟项相同的层次结构的成员时。在这种情况下,将假设计算属于该层次结构。示例:member(total(great_outdoors_company.Measur

33、es.Quantitysoldwithinset2005),Quantity2005,Quantitysold2005)c#Quantity5c4du帕盟nttymidaoosr1234f结果:fuoitityfddwld20052004561,706789,733ZOK769J30zm863!918789J3Q或者聚合以字母B开头的所有产品member(total(currentMeasurewithinsetfilter(great_outdoors_company.Products.Products.Productname,caption(great_outdoors_company.P

34、roducts.Products.Productname)startswithB),BProducts,BProducts,great_outdoors_company.Products.Products)结果:members语法:members(hierarchy|level)描述:返回位于某个层次结构或级别的成员集。对于层次结构,不能保证结果中的成员的顺序;如果需要一个可预测的顺序,必须使用一个显式的排序函数(比如hierarchize)。示例:members(great_outdoors_company.Years.Years)结果:Years20042004Q12004/Jan2004

35、/Feb2004/Mar2004Q22004/Apr2006Q32006/Jul2006/Aug2006/Sep2006Q42006/Oct2006/Nov2006/Decmembers(great_outdoors_company.Products.Products.Productline)结果:CampingEquipmentMountaineeringEquipmentPersonalAccessoriesOutdoorProtectionGolfEquipmentnestedSet语法:nestedSet(set_expr1,set_expr2)描述:返回在set_expr1的当前成员

36、的上下文中计算的set_expr2的成员集。示例:下面的示例计算了每个产品线的排名前两位的产品的收益。nestedSet(members(Productline),topCount(descendants(currentMember(great_outdoors_company.Products.Products),great_outdoors_company.Products.Products.Productname),2,Revenue)结果:pA,RevcriurCsrripJngEquipment;轧4月馄詔讯StarGases3$13,D44f9SlOCanIFEqijipmflnf

37、HEtqin1iteinfl們Wperilfiet117.96MsltetomSte&lWoods5et$419,643.36r*lowtaln?erlnflEquipmentnuskfRoceJOG5613,953.30HuskyftopeiO聲jBsg”疗討Outdoes-PrciectwnftjgShi枕1帕426,716.IB丸口銅曲-sbcnLit$3J5(i55,84PGr&wniflMurttairif4inEtre/re54,334.879.5GlacierGP3ti=trEHieS3,039.78,Z6nextMember语法:nextMember(member)描述:返回指

38、定成员所在的级别的下一个成员。示例:nextMember(OutdoorProtection)结果:GolfEquipmentopeningPeriod语法:openingperiod(level,member)描述:返回某个成员的位于指定级别的后代的第一个兄弟成员。通常与时间维度结合使用。示例:openingPeriod(great_outdoors_company.Years.Years.Month)结果:2004/JanopeningPeriod(great_outdoors_company.Years.Years.Year)结果:2004openingPeriod(great_outdoors_company.Years.Years.Month,2006Q4)结果:2006/Octorder语法:order(set_exp,value_exp,ASC|DESC|BASC|bdesc)描述:安排指定集合中的成员,依据是对集合中的每个值计算value_exp得到的值集合,该值集合通过第三个参数修改。排序有两种不同变体:层次结构式(ASC或DESC)和非层次结构式(BASC或BDESC,其中B表示breakhierarchy)。层次结构式排序首先根据成员在层次结构中的位置对它们进行安排。然后根据value_exp对每个成员的子成员排序。非层次结构式排序在集

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论