码迷,mamicode.com
首页 > 其他好文 > 详细

Cubu Browser报表设计

时间:2015-04-24 13:54:36      阅读:402      评论:0      收藏:0      [点我收藏+]

标签:

说明:本篇文章适合有一定SSRS技术基础的观看,特此注明。
 
一、共享数据源
 
数据源名称 数据源类型
dsSSAS SSAS数据源
dsAnySQLDB SQL数据源,TempDB数据库

二、Cube Browser报表
 
2.1 参数设计
 
序号 参数名称 描述 可用值 默认值 备注
1 pLag 度量、日期计算字段的关键参数。   12 图例1
2 pCube 多维数据集   [Adventure Works] 图例2
3 pMeasureGroup 度量值组   [Sales Summary] 图例3
4 pMeasure 度量   [Measures].[Gorss Profit] 图例4
5 pRowMbr 维度行   [Product].[Product Categories].[Subcategory].&[1] 图例5
6 pColMbr 维度列   [Sales Territory].[Sales Territory].[All Sales Territories] 图例6
7 pRowCount 行数   10 图例7
8 pColCount 列数   5 图例8
9 pFilterMbr 维度筛选器   [Promotion].[Promotions].[All Promotions] 图例9
10 pDateMbr 日期筛选器   [Date].[Calendar].[Month].&[2004]&[4] 图例10
11 pCallingReport 调用的报表   [&ReportName] 图例11
12 pTopOrBottom 排序 1、-1 1 图例12
13 pHighIsGoodOrBad 用于线图中醒目标记 Good、Bad Good  
 
注:感觉所有参数都应该自动确定是否刷新。
 
2.2 数据集
 
数据集设计要点:
查询设计器中、SSMS异同:
1、查询成员时,查询设计器会返回该成员的所有上级。
2、查询设计器会显示行组标题。
3、初始值非常重要,如果有一列为Null值,则数据集不会产生相应的字段,直接影响报表设计。
数据集设计参考:
1、基本格式:{(dataset)}、{( dataset*dataset )}、{({dataset},{dataset})}(此情况dataset需具备相同结构)
2、所有祖先、本身、子集:
STRTOSET("{ASCENDANTS("+@pRowMbr+"),"+@pRowMbr+".children}")
3、所有祖先及祖先兄弟、本身与本身兄弟、子集:
STRTOSET("{"
+GENERATE(
Ascendants(StrToMember(@pRowMbr))
,StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Uniquename")
,".siblings,"
)+".siblings,"
+@pRowMbr+".children"
+"}")
generate函数参考:
  1. with member measures.x as
  2. generate(ascendants([Date].[Calendar].currentmember)
  3. ,[Date].[Calendar].currentmember.uniquename
  4. ,".sibings,")+".sibings,"
结果:
  1. [Date].[Calendar].[Month].&[2000]&[2].sibings
  2. ,[Date].[Calendar].[CalendarQuarter].&[2000]&[1].sibings
  3. ,[Date].[Calendar].[CalendarSemester].&[2000]&[1].sibings
  4. ,[Date].[Calendar].[CalendarYear].&[2000].sibings
  5. ,[Date].[Calendar].[AllPeriods].sibings,
  6. 5、TopCount
    1. TOPCOUNT(
    2. STRTOSET("{ASCENDANTS("+@pColMbr+"),"+@pColMbr+".children}")
    3. ,StrToValue(@pColCount)
    4. ,[Measures].[ValueSort]
    5. )
  1. -------------------------------------------------------------------------------------------
  2. --ReportName:CubeBrowser
  3. --Author:GrantPaisley
  4. --Date:25Jan2010
  5. -------------------------------------------------------------------------------------------
  6. WITH
  7. --BasicMetadata
  8. MEMBER [Measures].[Lag] AS
  9. StrToValue(@pLag)
  10. --MeasureMetadata
  11. MEMBER [Measures].[Measure_Label] AS
  12. StrToValue(@pMeasure+".Member_Name")
  13. MEMBER [Measures].[Value] AS
  14. StrToValue(@pMeasure)
  15. MEMBER [Measures].[Value LY] AS
  16. StrToValue("([Measures].[Value],"+@pDateMbr+".Hierarchy.CurrentMember.Lag("+Str([Measures].[Lag])+"))")
  17. MEMBER [Measures].[ValueSort] AS
  18. strToValue("([Measures].[Value],"+@pDateMbr+")*"+@pTopOrBottom)
  19. --Date metadata
  20. MEMBER [Measures].[Date_Label] AS
  21. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Member_Caption")
  22. MEMBER [Measures].[Date_Key] AS
  23. StrToValue(@pDateMbr+".Hierarchy.Currentmember.Uniquename")
  24. MEMBER [Measures].[Date_Level] AS
  25. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  26. MEMBER [Measures].[DateLY_Label] AS
  27. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Lag("+Str([Measures].[Lag])+").Member_Caption")
  28. MEMBER [Measures].[DateLY_Key] AS
  29. StrToValue(@pDateMbr+".Hierarchy.Currentmember.Lag("+Str([Measures].[Lag])+").Uniquename")
  30. --Row metadata
  31. MEMBER [Measures].[Row_Label] AS
  32. StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Member_Caption")
  33. MEMBER [Measures].[Row_Key] AS
  34. StrToValue(@pRowMbr+".Hierarchy.Currentmember.Uniquename")
  35. MEMBER [Measures].[Row_Level_Name] AS
  36. StrToValue(@pRowMbr+".Hierarchy.Level.Name")
  37. MEMBER [Measures].[Row_Level] AS
  38. StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  39. MEMBER [Measures].[Row_Hierarchy_Name] AS
  40. StrToValue(@pRowMbr+".Hierarchy.Name")
  41. MEMBER [Measures].[Row_Hierarchy_UniqueName] AS
  42. StrToValue(@pRowMbr+".Hierarchy.UniqueName")
  43. MEMBER [Measures].[Row_Dimension_Name] AS
  44. StrToValue(@pRowMbr+".Dimension.Name")
  45. MEMBER [Measures].[Row_Dimension_UniqueName] AS
  46. StrToValue(@pRowMbr+".Dimension_Unique_Name")
  47. --Column metadata
  48. MEMBER [Measures].[Col_Label] AS
  49. StrToValue(@pColMbr+".Hierarchy.CurrentMember.Member_Caption")
  50. MEMBER [Measures].[Col_Key] AS
  51. StrToValue(@pColMbr+".Hierarchy.CurrentMember.UniqueName")
  52. MEMBER [Measures].[Col_Level_Name] AS
  53. StrToValue(@pColMbr+".Hierarchy.Level.Name")
  54. MEMBER [Measures].[Col_Level] AS
  55. StrToValue(@pColMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  56. MEMBER [Measures].[Col_Hierarchy_Name] AS
  57. StrToValue(@pColMbr+".Hierarchy.Name")
  58. MEMBER [Measures].[Col_Hierarchy_UniqueName] AS
  59. StrToValue(@pColMbr+".Hierarchy.UniqueName")
  60. MEMBER [Measures].[Col_Dimension_Name] AS
  61. StrToValue(@pColMbr+".Dimension.Name")
  62. MEMBER [Measures].[Col_Dimension_UniqueName] AS
  63. StrToValue(@pColMbr+".Dimension_Unique_Name")
  64. --Filter metadata
  65. MEMBER [Measures].[Filter_Label] AS
  66. StrToValue(@pFilterMbr+".Hierarchy.CurrentMember.Member_Caption")
  67. MEMBER [Measures].[Filter_Key] AS
  68. StrToValue(@pFilterMbr+".Hierarchy.Currentmember.Uniquename")
  69. MEMBER [Measures].[Filter_Level_Name] AS
  70. StrToValue(@pFilterMbr+".Hierarchy.Level.Name")
  71. MEMBER [Measures].[Filter_Level] AS
  72. StrToValue(@pFilterMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  73. MEMBER [Measures].[Filter_Hierarchy_Name] AS
  74. StrToValue(@pFilterMbr+".Hierarchy.Name")
  75. MEMBER [Measures].[Filter_Hierarchy_UniqueName] AS
  76. StrToValue(@pFilterMbr+".Hierarchy.UniqueName")
  77. MEMBER [Measures].[Filter_Dimension_Name] AS
  78. StrToValue(@pFilterMbr+".Dimension.Name")
  79. MEMBER [Measures].[Filter_Dimension_UniqueName] AS
  80. StrToValue(@pFilterMbr+".Dimension_Unique_Name")
  81. SELECT NON EMPTY {
  82. ---------------------
  83. [Measures].[Lag],
  84. ---------------------
  85. [Measures].[Measure_Label],
  86. [Measures].[Value],
  87. [Measures].[Value LY],
  88. [Measures].[ValueSort],
  89. ---------------------
  90. [Measures].[Date_Label],
  91. [Measures].[Date_Key],
  92. [Measures].[Date_Level],
  93.  
  94. [Measures].[DateLY_Key],
  95. [Measures].[DateLY_Label],
  96. ---------------------
  97. [Measures].[Row_Label],
  98. [Measures].[Row_Key],
  99. [Measures].[Row_Level_Name],
  100. [Measures].[Row_Level],
  101. [Measures].[Row_Hierarchy_Name],
  102. [Measures].[Row_Hierarchy_UniqueName],
  103. [Measures].[Row_Dimension_Name],
  104. [Measures].[Row_Dimension_UniqueName],
  105. ---------------------
  106. [Measures].[Col_Label],
  107. [Measures].[Col_Key],
  108. [Measures].[Col_Level_Name],
  109. [Measures].[Col_Level],
  110. [Measures].[Col_Hierarchy_Name],
  111. [Measures].[Col_Hierarchy_UniqueName],
  112. [Measures].[Col_Dimension_Name],
  113. [Measures].[Col_Dimension_UniqueName],
  114. ---------------------
  115. [Measures].[Filter_Label],
  116. [Measures].[Filter_Key],
  117. [Measures].[Filter_Level_Name],
  118. [Measures].[Filter_Level],
  119. [Measures].[Filter_Hierarchy_Name],
  120. [Measures].[Filter_Hierarchy_UniqueName],
  121. [Measures].[Filter_Dimension_Name],
  122. [Measures].[Filter_Dimension_UniqueName]
  123. } ON COLUMNS,
  124. {
  125. (
  126. STRTOMEMBER(@pDateMbr):STRTOMEMBER(@pDateMbr+".lag("+Str([Measures].[Lag]-1)+")")
  127. *TOPCOUNT(
  128. STRTOSET("{ASCENDANTS("+@pColMbr+"),"+@pColMbr+".children}")
  129. ,StrToValue(@pColCount)
  130. ,[Measures].[ValueSort]
  131. )
  132. *TOPCOUNT(
  133. STRTOSET("{ASCENDANTS("+@pRowMbr+"),"+@pRowMbr+".children}")
  134. ,StrToValue(@pRowCount)
  135. ,[Measures].[ValueSort]
  136. ------------------------------ only want parent,selfand children
  137. -- STRTOSET("{"+@pRowMbr+".parent,"+@pRowMbr+","+@pRowMbr+".children}")
  138. ------------------------------ want ancestors,selfand children & siblings
  139. -- STRTOSET("{"+
  140. -- GENERATE(
  141. --Ascendants(StrToMember(@pRowMbr))
  142. --,StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Uniquename")
  143. --,".siblings,"
  144. --)+".siblings,"
  145. --+@pRowMbr+".children"
  146. --+"}"
  147. --)
  148. )
  149. )
  150. } ON ROWS
  151. FROM [AdventureWorks]
  152. WHERE STRTOSET(@pFilterMbr)
技术分享
技术分享
 
2.3 主报表
 
技术分享
2.3.1 行区域
 
技术分享
提示:
="make "+Fields!Row_Key.Value+" focus(and show children)"
对齐:
=str( (Fields!Row_Level.Value * 4) + 2 ) + "pt"
字体:
=iif(Fields!Row_Key.Value=Parameters!pRowMbr.Value,"DimGray","Blue")
调用操作:
更改pRowMbr进行下钻
技术分享
分组:
技术分享
技术分享
效果:
技术分享
2.3.2 列区域设计
同行区域设计。
 
2.3.3 数据区
 
技术分享
填充:
=iif(Fields!Col_Key.Value=Parameters!pColMbr.Value
orFields!Row_Key.Value=Parameters!pRowMbr.Value,
"LemonChiffon",
Nothing
)
 
2.3.3.1 图表区
 
1、图表类型:折线图
2、设计:保留图表区,删除标题/图例,取消垂直轴和水平轴显示。
3、数据设计:
技术分享
4、图表属性:
名称:ChartTrend
填充:纯色
  1. =iif(Fields!Col_Key.Value=Parameters!pColMbr.Value
  2. orFields!Row_Key.Value=Parameters!pRowMbr.Value,
  3. "LemonChiffon",
  4. Nothing
  5. )
5、图表区属性
技术分享
6、Value_LY序列属性
技术分享
填充:纯色,银色
7、Value序列属性
技术分享
技术分享
跳转参数设计:
pRowHierarchy:[Row_Hierarchy_Name]
pRowMbr:[Row_Key]
pColHierarchy:[Col_Hierarchy_Name]
pColMbr:[Col_Key]
pCallingReport:[&ReportName]
填充:
  1. = iif(Parameters!pHighIsGoodOrBad.Value="Good",
  2. iif(Fields!Value.Value>Fields!Value_LY.Value,"Black","Red"),
  3. iif(Fields!Value.Value>Fields!Value_LY.Value,"Red","Black")
  4. )
边框:实线。
表达式:=iif(Fields!Date_Key.Value=Parameters!pDateMbr.Value,"2pt","0.5pt")
效果:
技术分享
技术分享
 
2.3.3.2 数据区
 
2.3.3.2.1 Value
 
技术分享
提示:
  1. =Fields!Measure_Label.Value+" was "
  2. +FormatNumber(Last(Fields!Value.Value))
  3. +" in "+Last(Fields!Date_Label.Value)
技术分享
自定义格式:
  1. =iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
  2. iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
  3. iif(last(abs(Fields!Value.Value))>10000,"#, k;(#, k)",
  4. iif(last(abs(Fields!Value.Value))>1000,"#,.0 k;(#,.0 k)",
  5. "#,#;(#,#)"))))
 
2.3.3.2.2 Value_LY
 
技术分享
  1. 提示:
  2. =Fields!Measure_Label.Value+" was "
  3. +FormatNumber(Last(Fields!Value_LY.Value))
  4. +" in "+Last(Fields!DateLY_Label.Value)
技术分享
  1. 自定义格式:
  2. =iif(last(abs(Fields!Value_LY.Value))>10000000,"#,, m;(#,, m)",
  3. iif(last(abs(Fields!Value_LY.Value))>1000000,"#,,.0 m;(#,,.0 m)",
  4. iif(last(abs(Fields!Value_LY.Value))>10000,"#,#, k;(#,#, k)",
  5. iif(last(abs(Fields!Value_LY.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
  6. "#,#;(#,#)"))))
字体
暗灰色
效果:
技术分享
 
2.4 行-筛选器/行-列置换区
 
技术分享
 
2.4.1 行-筛选器置换区
 
技术分享
  1. 提示:
  2. ="swap "+Fields!Row_Hierarchy_Name.Value
  3. +"(rows) with "+Fields!Filter_Hierarchy_Name.Value
  4. +"(filter)"
字体:
加粗、青蓝色
调用报表:[&ReportName]。参数:
pCallingReport:[&ReportName]
pFilterMbr:[@pRowMbr]
pRowMbr:[@pFilterMbr]
 
2.4.3 行-列置换区
 
技术分享
  1. 提示:
  2. ="swap "+Fields!Row_Hierarchy_Name.Value
  3. +"(rows) with "+Fields!Col_Hierarchy_Name.Value
  4. +"(columns)"
字体:
加粗、青蓝色
调用操作:[&ReportName]。参数:
pCallingReport:[&ReportName]
pColMbr:[@pRowMbr]
pRowMbr:[@pColMbr]
 
2.5 排序
 
技术分享
技术分享
数据集:
  1. select‘1‘asValue,‘Top‘asValueName
  2. union
  3. select‘-1‘,‘Bottom‘
提示:
="show "+Fields!ValueName.Value+" values"
字体:
  1. =iif(Parameters!pTopOrBottom.Value=Fields!value.Value,
  2. "DimGray",
  3. "CornflowerBlue"
  4. )
调用操作:[&ReportName]。参数:
pTopOrBottom:[value]
列分组:
Value。
 
2.6 行/列数量
 
技术分享
技术分享
数据集:
  1. Select5asCellCount
  2. union all
  3. select6
  4. union all
  5. select7
  6. union all
  7. select10
  8. union all
  9. select20
  10. union all
  11. select50
提示:
="show "+ str(Fields!CellCount.Value)+" columns"
字体:
  1. =iif(Parameters!pColCount.Value=Fields!CellCount.Value,
  2. "DimGray",
  3. "CornflowerBlue"
  4. )
调用操作:[&ReportName]。参数:
pColCount:[CellCount]
行或列分组:
CellCount
 
2.7 Lag
 
技术分享
数据集:
  1. Select2asLag
  2. union all
  3. select3
  4. union all
  5. select4
  6. union all
  7. select6
  8. union all
  9. select7
  10. union all
  11. select12
提示:
="show "+ str(Fields!Lag.Value)+" periods in Australian Sparkline"
字体:
  1. =iif(Parameters!pLag.Value=Fields!Lag.Value,
  2. "DimGray",
  3. "CornflowerBlue"
  4. )
调用操作:[&ReportName]。参数:
pLag:Lag
列分组:
Lag
 
2.8 日期、行、列、筛选器
 
技术分享
 
2.8.1 度量
 
技术分享
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
 
2.8.2 日期
 
技术分享
  1. 值:
  2. = left(First(Fields!Date_Label.Value),3)+" "
  3. + right(First(Fields!Date_Label.Value),4)+" - "
  4. + left(Last(Fields!Date_Label.Value),3)+" "
  5. + right(Last(Fields!Date_Label.Value),4)
字体:
加粗、青蓝色
调用操作:Angry Koala Member。参数:
pCallingReport:[&ReportName]
pDriver:DateMbr(纯文本)
 
2.8.3 行
 
技术分享
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
pDriver:RowMbr
pDimension:[Row_Dimension_UniqueName]
pHierarchy:[Row_Hierarchy_UniqueName]
 
2.7.4 列
 
技术分享
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
pDriver:ColMbr
pDimension:[Col_Dimension_UniqueName]
pHierarchy:[Col_Hierarchy_UniqueName]
 
行列单元格的行分组:
技术分享
 
2.8.5 过滤器
 
2.8.5.1 层次结构
 
技术分享
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
pDriver:FilterMbr
pDimension:[Filter_Dimension_UniqueName]
pHierarchy:[Filter_Hierarchy_UniqueName]
 
2.8.6 值
 
技术分享
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
pDriver:FilterMbr
pDimension:[Filter_Dimension_UniqueName]
pHierarchy:[Filter_Hierarchy_UniqueName]
 
2.9 页脚开发
技术分享
 
2.9.1 浏览者、执行时间
  1.  
  2. ="run by "&User!UserID+" in "+
  3. IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).TotalSeconds<1
  4. , "< 1 second"
  5. ,(
  6. IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours>0
  7. ,System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours&" hour(s), "
  8. ,"")+
  9. IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes>0
  10. ,System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes&" minute(s), "
  11. ,"")+
  12. IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds>0
  13. ,System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds&" second(s)"
  14. ,"")
  15. )
  16. )
 
2.9.2 日期
=FormatDateTime(Globals!ExecutionTime,3)&" "&FormatDateTime(Globals!ExecutionTime,1)
 
2.9.3 页面编号
="Page "&Globals!PageNumber&" of "&Globals!TotalPages
 
2.9.4、报表信息
  1. =Parameters!pDateMbr.Value+VbCrLf
  2. +Parameters!pCube.Value+VbCrLf
  3. +Parameters!pMeasureGroup.Value+VbCrLf
  4. +Parameters!pMeasure.Value+VbCrLf
  5. +Parameters!pRowMbr.Value+VbCrLf
  6. +Parameters!pColMbr.Value+VbCrLf
  7. +Parameters!pFilterMbr.Value
 
三、Graph报表设计
 
3.1 参数设计
 
pDateMbr:提示Date,隐藏,默认值:[Date].[Calendar].[Month].&[2004]&[4]
pCube:提示pCube隐藏,默认值:[Adventure Works]
pMeasureGroup提示pMeasureGroup隐藏,默认值:Reseller Sales
pMeasure提示pMeasure,隐藏,默认值:[Measures].[Gross Profit]
pRowDim提示pRowDim,隐藏,默认值:="[Geography]"
pRowHierarchy提示pRowHierarchy,隐藏,默认值:[Product].[Product Categories]
pRowMbr提示pRowMbr,隐藏,默认值:[Product].[Product Categories].[Subcategory].&[1]
pColDim:提示pColDim,隐藏,默认值:="[Product]"
pColHierarchy:提示pColHierarchy,隐藏,默认值:[Sales Territory].[Sales Territories]
pColMbr提示Column Member,隐藏,默认值:[Sales Territory].[Sales Territory].[All Sales Territories]
pRowCount提示Row Count,隐藏,默认值:7
pLag提示pLag隐藏,默认值:12
pColCount提示Column Count,隐藏,默认值:5
pCallingReport提示pCallingReport,隐藏,默认值:r100 - Angry Koala Cube Browser
pFilterMbr提示pFilterMbr,隐藏,默认值:[Promotion].[Promotions].[All Promotions]
pTopOrBottom提示Top or Bottom,隐藏,默认值:1
pHighIsGoodOrBad提示High is,隐藏,默认值:Good
 
3.2 标题提示区
 
技术分享
数据集:
  1. -----------------------------------------------------------------------------
  2. --GrantPaisley
  3. --AngryKoala
  4. --28Nov2008
  5. -----------------------------------------------------------------------------
  6. WITH
  7. MEMBER [Measures].[Lag] AS
  8. iif(left(@pLag,1)="[",12,StrToValue(@pLag))
  9. MEMBER [Measures].[Measure_Label] AS
  10. iif(left(@pMeasure,10)="[Measures]"
  11. ,StrToValue(@pMeasure+".Member_Name")
  12. ,StrToValue("[Measures].[Reseller Sales Amount].Member_Name")
  13. )
  14. MEMBER [Measures].[Value] AS
  15. iif(left(@pMeasure,10)="[Measures]"
  16. ,StrToValue(@pMeasure)
  17. ,StrToValue("[Measures].[Reseller Sales Amount]")
  18. )
  19. MEMBER [Measures].[Value LY] AS
  20. StrToValue("( [Measures].[Value], "+@pDateMbr
  21. +".Hierarchy.CurrentMember.Lag("
  22. +Str([Measures].[Lag])+")) "
  23. )
  24. MEMBER [Measures].[Date_Label] AS
  25. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Member_Caption")
  26. MEMBER [Measures].[Date_Key] AS
  27. StrToValue(@pDateMbr+".Hierarchy.Currentmember.Uniquename")
  28. MEMBER [Measures].[Date_Level] AS
  29. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  30. MEMBER [Measures].[DateLY_Label] AS
  31. StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Lag("
  32. +Str([Measures].[Lag])+" ).Member_Caption "
  33. )
  34. MEMBER [Measures].[DateLY_Key] AS
  35. StrToValue(@pDateMbr+".Hierarchy.Currentmember.Lag("
  36. +Str([Measures].[Lag])+" ).Uniquename")
  37. MEMBER [Measures].[RowFocus] AS
  38. strtovalue(‘"‘+@pRowMbr+‘"‘)
  39. MEMBER [Measures].[ColFocus] AS
  40. strtovalue(‘"‘+@pColMbr+‘"‘)
  41. MEMBER [Measures].[Row_Label] AS
  42. StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Member_Caption")
  43. MEMBER [Measures].[Row_Key] AS
  44. StrToValue(@pRowMbr+".Hierarchy.Currentmember.Uniquename")
  45. MEMBER [Measures].[Row_Level_Name] AS
  46. StrToValue(@pRowMbr+".Hierarchy.Level.Name")
  47. MEMBER [Measures].[Row_Level] AS
  48. StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  49. MEMBER [Measures].[Row_Dimension_Name] AS
  50. StrToValue(@pRowMbr+".Dimension.Name")
  51. MEMBER [Measures].[Row_Hierarchy_Name] AS
  52. StrToValue(@pRowMbr+".Hierarchy.Name")
  53. MEMBER [Measures].[Col_Label] AS
  54. StrToValue(@pColMbr+".Hierarchy.CurrentMember.Member_Caption")
  55. MEMBER [Measures].[Col_Key] AS
  56. StrToValue(@pColMbr+".Hierarchy.CurrentMember.UniqueName")
  57. MEMBER [Measures].[Col_Level_Name] AS
  58. StrToValue(@pColMbr+".Hierarchy.Level.Name")
  59. MEMBER [Measures].[Col_Level] AS
  60. StrToValue(@pColMbr+".Hierarchy.CurrentMember.Level.Ordinal")
  61. MEMBER [Measures].[Col_Dimension_Name] AS
  62. StrToValue(@pColMbr+".Dimension.Name")
  63. MEMBER [Measures].[Col_Hierarchy_Name] AS
  64. StrToValue(@pColMbr+".Hierarchy.Name")
  65. SELECT NON EMPTY {
  66. [Measures].[Lag],
  67. [Measures].[Date_Key],
  68. [Measures].[Date_Label],
  69. [Measures].[Date_Level],
  70. [Measures].[DateLY_Key],
  71. [Measures].[DateLY_Label],
  72. [Measures].[Measure_Label],
  73. [Measures].[RowFocus],
  74. [Measures].[Row_Key],
  75. [Measures].[Row_Label],
  76. [Measures].[Row_Level],
  77. [Measures].[Row_Level_Name],
  78. [Measures].[Row_Hierarchy_Name],
  79. [Measures].[Row_Dimension_Name],
  80. [Measures].[ColFocus],
  81. [Measures].[Col_Key],
  82. [Measures].[Col_Label],
  83. [Measures].[Col_Level],
  84. [Measures].[Col_Level_Name],
  85. [Measures].[Col_Hierarchy_Name],
  86. [Measures].[Col_Dimension_Name],
  87. [Measures].[Value],
  88. [Measures].[Value LY]
  89. } ON COLUMNS,
  90. NON EMPTY {(
  91. STRTOMEMBER(@pDateMbr):STRTOMEMBER(@pDateMbr+".lag("+Str([Measures].[Lag]-1)+")")
  92. *STRTOSET("{"+[Measures].[ColFocus]+"}")
  93. *STRTOSET("{"+[Measures].[RowFocus]+"}")
  94. )}--DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME
  95. ON ROWS
  96. FROM [AdventureWorks]
  97. WHERE STRTOMEMBER(@pFilterMbr)
  98. --CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
 
3.2.1 度量
 
技术分享
字体:
加粗,暗灰色
 
3.2.2 日期
 
技术分享
值:
  1. =left(First(Fields!Date_Label.Value),3)
  2. +" - "
  3. + left(Last(Fields!Date_Label.Value),3)
  4. + right(Last(Fields!Date_Label.Value),5)
字体:
加粗,暗灰色
 
3.2.3 行
 
技术分享
字体:
加粗,暗灰色
 
3.2.4 列
 
技术分享
字体:
加粗,暗灰色
 
3.2.5 分组
 
技术分享
 
3.3 主报表
 
技术分享
 
3.3.1 图表
 
技术分享
填充:
白色
 
3.3.1.1 垂直轴属性
 
技术分享
技术分享
技术分享
数字:自定义格式
  1. =iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
  2. iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
  3. iif(last(abs(Fields!Value.Value))>10000,"#,#, k;(#,#, k)",
  4. iif(last(abs(Fields!Value.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
  5. "#,#;(#,#)"))))
技术分享
技术分享
技术分享
 
3.3.1.2 水平轴属性
 
技术分享
技术分享
技术分享
技术分享
技术分享
技术分享
 
3.3.1.3 图表区
 
不启用三维
填充:
自动
 
3.3.1.4 Value序列属性
 
技术分享
填充:
=iif(Fields!Value.Value>Fields!Value_LY.Value,"Black","Red")
线条:
=iif(Fields!Date_Key.Value=Parameters!pDateMbr.Value,"4pt","1pt")
 
3.3.1.5 Value_LY
 
技术分享
填充:
灰色
 
3.3.2 数据区
 
3.3.2.1 Value
 
技术分享
提示:
  1. =Fields!Measure_Label.Value+" was "
  2. +FormatNumber(Last(Fields!Value.Value))
  3. +" in "+Last(Fields!Date_Label.Value)
数字:
  1. =iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
  2. iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
  3. iif(last(abs(Fields!Value.Value))>10000,"#,#, k;(#,#, k)",
  4. iif(last(abs(Fields!Value.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
  5. "#,#;(#,#)"))))
填充:
白色
 
3.3.2.2 Value_LY
 
技术分享
提示:
  1. =Fields!Measure_Label.Value+" was "
  2. +FormatNumber(Last(Fields!Value_LY.Value))
  3. +" in "+Last(Fields!DateLY_Label.Value)
数字:
  1. =iif(last(abs(Fields!Value_LY.Value))>10000000,"#,, m;(#,, m)",
  2. iif(last(abs(Fields!Value_LY.Value))>1000000,"#,,.0 m;(#,,.0 m)",
  3. iif(last(abs(Fields!Value_LY.Value))>10000,"#,#, k;(#,#, k)",
  4. iif(last(abs(Fields!Value_LY.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
  5. "#,#;(#,#)"))))
字体:
暗灰色
 
3.3.3 对比报表
 
技术分享
 
列分组:
Date_Key
Value/Value_LY数字自定义格式:
  1. =iif(abs(Fields!Value.Value)>10000000,"#,, m;(#,, m)",
  2. iif(abs(Fields!Value.Value)>1000000,"#,,.0 m;(#,,.0 m)",
  3. iif(abs(Fields!Value.Value)>10000,"#, k;(#, k)",
  4. iif(abs(Fields!Value.Value)>1000,"#,.0 k;(#,.0 k)",
  5. "#,#;(#,#)"))))
Value_LY字体:
暗灰色
 
效果:
技术分享
 
四、Driver报表
 
技术分享
 
4.1 参数设计
 
pDatabase:Adventure Works DW 2008
pCube:Channel Sales
pMeasureGroup:Reseller Sales
pDimension:="[Customer]"
pHierarchy:="[Customer].[Customer Geography]"
pDateMbr:[Date].[Calendar].[Month].&[2004]&[6]
pMeasure:[Measures].[Reseller Sales Amount]
pRowMbr:[Geography].[Geography].[All Geographies]
pColMbr:[Product].[Product Categories].[All Products]
pRowCount:7
pLag:3
pColCount:5
pCallingReport:Cube Browser
pDriver:pMeasure
pFilterMbr:[Product].[Color].[All]
pTopOrBottom:1
pHighIsGoodOrBad:High is
 
4.2 数据集
 
4.2.1 DataBases
 
技术分享
 
4.2.2 Cubes
 
技术分享
查询:
  1. ="select * from $System.MDSCHEMA_CUBES WHERE CUBE_SOURCE = 1 AND [CATALOG_NAME] = ‘"
  2. &Parameters!pDatabase.Value&"‘"
参数:
pDatabase:[@pDatabase]
 
4.2.3 Dimensions
 
技术分享
  1. 查询:
  2. ="select * from $System.MDSCHEMA_DIMENSIONS WHERE CUBE_NAME = ‘"
  3. &Parameters!pCube.Value&"‘"
技术分享
值:
  1. =iif(Parameters!pDriver.Value="pMeasure",
  2. "Select a cube and measure",
  3. iif(Parameters!pDriver.Value="pRowMbr",
  4. "Select another hierarchy for Rows",
  5. "Select another hierarchy for Columns"
  6. )
  7. )
 
4.2.4 Hierarachies
 
技术分享
查询:
  1. ="select * from $System.MDSCHEMA_HIERARCHIES"
  2. +" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
技术分享
参数:
pCube:[@pCube]
pDimension:[@pDimension]
 
4.2.5 MeasureGroupDimensions
 
技术分享
查询:
  1. ="Select * from $System.MDSCHEMA_MEASUREGROUP_DIMENSIONS "
  2. +" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
  3. +" AND MEASUREGROUP_NAME = ‘"&Parameters!pMeasureGroup.Value&"‘"
参数:
pCube:[@pCube]
pMeasureGroup:[@pMeasureGroup]
 
4.2.6 Level
 
技术分享
查询:
  1. ="select * from $System.MDSCHEMA_LEVELS WHERE CUBE_NAME = ‘"
  2. &Parameters!pCube.Value&"‘"
技术分享
参数:
pCube:[@pCube]
 
4.2.7 MeasureGroups
 
技术分享
查询:
  1. ="Select * from $System.MDSCHEMA_MEASUREGROUPS WHERE CUBE_NAME = ‘"
  2. &Parameters!pCube.Value&"‘"
参数:
pCube:[@pCube]
 
4.2.8 Measures
 
技术分享
查询:
  1. ="Select * from $System.MDSCHEMA_MEASURES"
  2. +" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
  3. +" AND ( MEASUREGROUP_NAME = ‘"&Parameters!pMeasureGroup.Value&"‘"
  4. +" OR MEASURE_DISPLAY_FOLDER = ‘"&Parameters!pMeasureGroup.Value&"‘ )"
参数:
pCube:[@pCube]
 
4.3 报表设计
 
技术分享
 
4.3.1 标题
 
技术分享
值:
  1. =iif(Parameters!pDriver.Value="pMeasure",
  2. "Select a cube and measure",
  3. iif(Parameters!pDriver.Value="pRowMbr",
  4. "Select another hierarchy for Rows",
  5. "Select another hierarchy for Columns")
  6. )
 
4.3.2 Dimensions
 
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",True,False)
 
文本框属性:
技术分享
值:
  1. =right(
  2. left(
  3. Fields!DIMENSION_UNIQUE_NAME.Value,
  4. len(Fields!DIMENSION_UNIQUE_NAME.Value)-1
  5. ),
  6. len(Fields!DIMENSION_UNIQUE_NAME.Value)-2
  7. )
填充:
  1. =iif(Fields!DIMENSION_UNIQUE_NAME.Value=Parameters!pDimension.Value
  2. ,"LemonChiffon","White")
调用操作:[&ReportName]。参数:
pDimension:[DIMENSION_UNIQUE_NAME]
 
4.3.3 Hierarchy
 
技术分享
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",True,False)
 
4.3.3.1 [HIERARCHY_DISPLAY_FOLDER]
 
技术分享
 
分组:
技术分享
技术分享
 
4.3.3.2 [HIERARCHY_NAME]
 
技术分享
颜色:
蓝色
填充:
  1. =iif(Fields!HIERARCHY_UNIQUE_NAME.Value=Parameters!pHierarchy.Value
  2. ,"LemonChiffon","White")
调用操作:[@pCallingReport]。参数:
pRowMbr:
  1. =iif(Parameters!pDriver.Value="RowMbr",
  2. Fields!DEFAULT_MEMBER.Value,
  3. Parameters!pRowMbr.Value
  4. )
pColMbr:
  1. =iif(Parameters!pDriver.Value="ColMbr",
  2. Fields!DEFAULT_MEMBER.Value,
  3. Parameters!pColMbr.Value
  4. )
pFilterMbr:
  1. =iif(Parameters!pDriver.Value="FilterMbr",
  2. Fields!DEFAULT_MEMBER.Value,
  3. Parameters!pFilterMbr.Value
  4. )
 
分组:Details
 
4.3.3.3 Level
 
技术分享
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",True,False)
 
分组:
details
 
4.3.3.4 Cube
 
技术分享
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",False,True)
 
文本框属性:
技术分享
填充:
=iif(Fields!CUBE_NAME.Value=Parameters!pCube.Value,"LemonChiffon","White")
调用操作:[&ReportName]。参数:
pCube:[CUBE_NAME]
 
4.3.3.5 MeasureGroup
 
技术分享
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",False,True)
 
文本框属性:
技术分享
填充:
  1. =iif(Fields!MEASUREGROUP_NAME.Value=Parameters!pMeasureGroup.Value
  2. ,"LemonChiffon","White")
调用操作:[&ReportName]。参数:
pCube:[CUBE_NAME]
pMeasureGroup:[MEASUREGROUP_NAME]
 
4.3.3.6 Measure
 
技术分享
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",False,True)
 
文本框属性:
同hierarchy。
调用操作:[@pCallingReport]。参数:
pMeasure:[MEASURE_UNIQUE_NAME]
pCube:[CUBE_NAME]
pMeasureGroup:[MEASUREGROUP_NAME]
 
五、Member报表
 
技术分享
 
5.1 参数
 
pDateMbr:[Date].[Calendar].[Month].&[2004]&[4]
pCube:Channel Sales
pMeasureGroup:Reseller Sales
pMeasure:[Measures].[Gross Profit]
pRowMbr:[Product].[Product Categories].[Subcategory].&[1]
pColMbr:[Sales Territory].[Sales Territory].[All Sales Territories]
pRowCount:6
pLag:12
pColCount:5
pCallingReport:Cube Browser
pDriver:DateMbr
pFilterMbr:[Promotion].[Promotions].[All Promotions]
pTopOrBottom:1
pHighIsGoodOrBad:Good
 
5.2 数据集
 
5.2.1 Dataset1
 
  1. --------------------------------------------------------------------
  2. --GrantPaisley
  3. --AngryKoala
  4. --Nov2011
  5. --------------------------------------------------------------------
  6. WITH
  7. MEMBER [Measures].[Mbr_Key] AS
  8. iif(@pDriver="DateMbr",@pDateMbr,
  9. iif(@pDriver="RowMbr",@pRowMbr,
  10. iif(@pDriver="ColMbr",@pColMbr,
  11. iif(@pDriver="FilterMbr",@pFilterMbr,@pDateMbr))))
  12. MEMBER [Measures].[Measure_Label] AS
  13. iif(left(@pMeasure,10)="[Measures]"
  14. ,StrToValue(@pMeasure+".Member_Name")
  15. ,StrToValue("[Measures].[Reseller Order Quantity].Member_Name"))
  16. MEMBER [Measures].[Value] AS
  17. iif(left(@pMeasure,10)="[Measures]"
  18. ,StrToValue(@pMeasure)
  19. ,StrToValue("[Measures].[Reseller Order Quantity]"))
  20. MEMBER [Measures].[RowFocus] AS
  21. strtovalue(‘"‘+[Measures].[Mbr_Key]+‘"‘)
  22. MEMBER [Measures].[Row_Label] AS
  23. StrToValue([Measures].[Mbr_Key]+".Hierarchy.CurrentMember.Member_Caption")
  24. MEMBER [Measures].[Row_Key] AS
  25. StrToValue([Measures].[Mbr_Key]+".Hierarchy.Currentmember.Uniquename")
  26. MEMBER [Measures].[Row_Level_Name] AS
  27. StrToValue([Measures].[Mbr_Key]+".Hierarchy.Level.Name")
  28. MEMBER [Measures].[Row_Level] AS
  29. StrToValue([Measures].[Mbr_Key]+".Hierarchy.CurrentMember.Level.Ordinal")
  30. MEMBER [Measures].[Row_Hierarchy_Name] AS
  31. StrToValue([Measures].[Mbr_Key]+".Hierarchy.Name")
  32. MEMBER [Measures].[Row_Dimension_Name] AS
  33. StrToValue([Measures].[Mbr_Key]+".Dimension.Name")
  34. MEMBER [MEASURES].MbrIsAncestor AS
  35. Strtovalue("IsAncestor( "+[Measures].[Mbr_Key]+".hierarchy.currentmember, "+[Measures].[Mbr_Key]+" )"
  36. +"or("+[Measures].[Mbr_Key]+".hierarchy.currentmember is "+[Measures].[Mbr_Key]+")"
  37. )
  38. SELECT NON EMPTY {
  39. [Measures].[Measure_Label],
  40. [Measures].[Mbr_Key],
  41. [Measures].[RowFocus],
  42. [Measures].[Row_Key],
  43. [Measures].[Row_Label],
  44. [Measures].[Row_Level],
  45. [Measures].[Row_Level_Name],
  46. [Measures].[Row_Hierarchy_Name],
  47. [Measures].[Row_Dimension_Name],
  48. [Measures].[MbrIsAncestor],
  49. [Measures].[Value]
  50. } ON COLUMNS,
  51. NON EMPTY {(
  52. STRTOSET("{"+
  53. GENERATE(
  54. ASCENDANTS(STRTOMEMBER([Measures].[RowFocus]))
  55. ,STRTOVALUE([Measures].[RowFocus]+".Hierarchy.CURRENTMEMBER.Uniquename")
  56. ,".siblings, "
  57. )+".siblings,"
  58. +[Measures].[RowFocus]+".children"
  59. +"}")
  60. )}
  61. ON ROWS
  62. FROM [AdventureWorks]
技术分享
 
5.2.2 CellCount
 
  1. Select5asCellCount
  2. union all
  3. select6
  4. union all
  5. select7
  6. union all
  7. select10
  8. union all
  9. select20
  10. union all
  11. select50
技术分享
 
5.2.3 Lag
 
  1. Select2asLag
  2. union all
  3. select3
  4. union all
  5. select4
  6. union all
  7. select6
  8. union all
  9. select12
技术分享
 
5.3 标题
 
="Select "+First(Fields!Row_Hierarchy_Name.Value,"DataSet1")+" member"
 
5.4 报表区
 
列分组:
技术分享
技术分享
 
5.4.1 Row_Label
 
行分组:
技术分享
技术分享
 
文本框属性:
技术分享
调用操作:[@pCallingReport]。参数:
pDateMbr:
  1. =iif(Parameters!pDriver.Value="DateMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pDateMbr.Value)
pRowMbr:
  1. =iif(Parameters!pDriver.Value="RowMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pRowMbr.Value)
pColMbr:
  1. =iif(Parameters!pDriver.Value="ColMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pColMbr.Value)
pFilterMbr:
  1. =iif(Parameters!pDriver.Value="FilterMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pFilterMbr.Value)
 
5.4.2 右边表达式
 
技术分享
值:
  1. =iif(Fields!MbrIsAncestor.Value,
  2. "+ ==>",
  3. "+"
  4. )
调用操作:[&ReportName]。参数:
pDateMbr:
  1. =iif(Parameters!pDriver.Value="DateMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pDateMbr.Value)
pRowMbr:
  1. =iif(Parameters!pDriver.Value="RowMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pRowMbr.Value)
pColMbr:
  1. =iif(Parameters!pDriver.Value="ColMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pColMbr.Value)
pFilterMbr:
  1. =iif(Parameters!pDriver.Value="FilterMbr"
  2. ,Fields!Row_Key.Value
  3. ,Parameters!pFilterMbr.Value)
 
六、用图附录
 
6.1 图例1
 
技术分享
技术分享
技术分享
 
6.2 图例2
 
技术分享
技术分享
技术分享
 
6.3 图例3
 
技术分享
技术分享
技术分享
 
6.4 图例4
 
技术分享
技术分享
技术分享
 
6.5 图例5
 
技术分享
技术分享
技术分享
 
6.6 图例6
 
技术分享
技术分享
技术分享
 
6.7 图例7
 
技术分享
技术分享
技术分享
 
6.8 图例8
 
技术分享
技术分享
技术分享
 
6.9 图例9
 
技术分享
技术分享
技术分享
 
6.10 图例10
 
技术分享
技术分享
技术分享
 
6.11 图例11
 
技术分享
技术分享
技术分享
 
6.12 图例12
 
技术分享
技术分享
技术分享
技术分享
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 





Cubu Browser报表设计

标签:

原文地址:http://www.cnblogs.com/hispring/p/4453168.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!