说明:本篇文章适合有一定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函数参考:
with member measures.x as
generate(ascendants([Date].[Calendar].currentmember)
,[Date].[Calendar].currentmember.uniquename
,".sibings,")+".sibings,"
结果:
[Date].[Calendar].[Month].&[2000]&[2].sibings
,[Date].[Calendar].[CalendarQuarter].&[2000]&[1].sibings
,[Date].[Calendar].[CalendarSemester].&[2000]&[1].sibings
,[Date].[Calendar].[CalendarYear].&[2000].sibings
,[Date].[Calendar].[AllPeriods].sibings,
- 5、TopCount
-
TOPCOUNT(
STRTOSET("{ASCENDANTS("+@pColMbr+"),"+@pColMbr+".children}")
,StrToValue(@pColCount)
,[Measures].[ValueSort]
)
-------------------------------------------------------------------------------------------
--ReportName:CubeBrowser
--Author:GrantPaisley
--Date:25Jan2010
-------------------------------------------------------------------------------------------
WITH
--BasicMetadata
MEMBER [Measures].[Lag] AS
StrToValue(@pLag)
--MeasureMetadata
MEMBER [Measures].[Measure_Label] AS
StrToValue(@pMeasure+".Member_Name")
MEMBER [Measures].[Value] AS
StrToValue(@pMeasure)
MEMBER [Measures].[Value LY] AS
StrToValue("([Measures].[Value],"+@pDateMbr+".Hierarchy.CurrentMember.Lag("+Str([Measures].[Lag])+"))")
MEMBER [Measures].[ValueSort] AS
strToValue("([Measures].[Value],"+@pDateMbr+")*"+@pTopOrBottom)
--Date metadata
MEMBER [Measures].[Date_Label] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Date_Key] AS
StrToValue(@pDateMbr+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Date_Level] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[DateLY_Label] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Lag("+Str([Measures].[Lag])+").Member_Caption")
MEMBER [Measures].[DateLY_Key] AS
StrToValue(@pDateMbr+".Hierarchy.Currentmember.Lag("+Str([Measures].[Lag])+").Uniquename")
--Row metadata
MEMBER [Measures].[Row_Label] AS
StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Row_Key] AS
StrToValue(@pRowMbr+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Row_Level_Name] AS
StrToValue(@pRowMbr+".Hierarchy.Level.Name")
MEMBER [Measures].[Row_Level] AS
StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Row_Hierarchy_Name] AS
StrToValue(@pRowMbr+".Hierarchy.Name")
MEMBER [Measures].[Row_Hierarchy_UniqueName] AS
StrToValue(@pRowMbr+".Hierarchy.UniqueName")
MEMBER [Measures].[Row_Dimension_Name] AS
StrToValue(@pRowMbr+".Dimension.Name")
MEMBER [Measures].[Row_Dimension_UniqueName] AS
StrToValue(@pRowMbr+".Dimension_Unique_Name")
--Column metadata
MEMBER [Measures].[Col_Label] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Col_Key] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.UniqueName")
MEMBER [Measures].[Col_Level_Name] AS
StrToValue(@pColMbr+".Hierarchy.Level.Name")
MEMBER [Measures].[Col_Level] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Col_Hierarchy_Name] AS
StrToValue(@pColMbr+".Hierarchy.Name")
MEMBER [Measures].[Col_Hierarchy_UniqueName] AS
StrToValue(@pColMbr+".Hierarchy.UniqueName")
MEMBER [Measures].[Col_Dimension_Name] AS
StrToValue(@pColMbr+".Dimension.Name")
MEMBER [Measures].[Col_Dimension_UniqueName] AS
StrToValue(@pColMbr+".Dimension_Unique_Name")
--Filter metadata
MEMBER [Measures].[Filter_Label] AS
StrToValue(@pFilterMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Filter_Key] AS
StrToValue(@pFilterMbr+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Filter_Level_Name] AS
StrToValue(@pFilterMbr+".Hierarchy.Level.Name")
MEMBER [Measures].[Filter_Level] AS
StrToValue(@pFilterMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Filter_Hierarchy_Name] AS
StrToValue(@pFilterMbr+".Hierarchy.Name")
MEMBER [Measures].[Filter_Hierarchy_UniqueName] AS
StrToValue(@pFilterMbr+".Hierarchy.UniqueName")
MEMBER [Measures].[Filter_Dimension_Name] AS
StrToValue(@pFilterMbr+".Dimension.Name")
MEMBER [Measures].[Filter_Dimension_UniqueName] AS
StrToValue(@pFilterMbr+".Dimension_Unique_Name")
SELECT NON EMPTY {
---------------------
[Measures].[Lag],
---------------------
[Measures].[Measure_Label],
[Measures].[Value],
[Measures].[Value LY],
[Measures].[ValueSort],
---------------------
[Measures].[Date_Label],
[Measures].[Date_Key],
[Measures].[Date_Level],
[Measures].[DateLY_Key],
[Measures].[DateLY_Label],
---------------------
[Measures].[Row_Label],
[Measures].[Row_Key],
[Measures].[Row_Level_Name],
[Measures].[Row_Level],
[Measures].[Row_Hierarchy_Name],
[Measures].[Row_Hierarchy_UniqueName],
[Measures].[Row_Dimension_Name],
[Measures].[Row_Dimension_UniqueName],
---------------------
[Measures].[Col_Label],
[Measures].[Col_Key],
[Measures].[Col_Level_Name],
[Measures].[Col_Level],
[Measures].[Col_Hierarchy_Name],
[Measures].[Col_Hierarchy_UniqueName],
[Measures].[Col_Dimension_Name],
[Measures].[Col_Dimension_UniqueName],
---------------------
[Measures].[Filter_Label],
[Measures].[Filter_Key],
[Measures].[Filter_Level_Name],
[Measures].[Filter_Level],
[Measures].[Filter_Hierarchy_Name],
[Measures].[Filter_Hierarchy_UniqueName],
[Measures].[Filter_Dimension_Name],
[Measures].[Filter_Dimension_UniqueName]
} ON COLUMNS,
{
(
STRTOMEMBER(@pDateMbr):STRTOMEMBER(@pDateMbr+".lag("+Str([Measures].[Lag]-1)+")")
*TOPCOUNT(
STRTOSET("{ASCENDANTS("+@pColMbr+"),"+@pColMbr+".children}")
,StrToValue(@pColCount)
,[Measures].[ValueSort]
)
*TOPCOUNT(
STRTOSET("{ASCENDANTS("+@pRowMbr+"),"+@pRowMbr+".children}")
,StrToValue(@pRowCount)
,[Measures].[ValueSort]
------------------------------ only want parent,selfand children
-- STRTOSET("{"+@pRowMbr+".parent,"+@pRowMbr+","+@pRowMbr+".children}")
------------------------------ want ancestors,selfand children & siblings
-- STRTOSET("{"+
-- GENERATE(
--Ascendants(StrToMember(@pRowMbr))
--,StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Uniquename")
--,".siblings,"
--)+".siblings,"
--+@pRowMbr+".children"
--+"}"
--)
)
)
} ON ROWS
FROM [AdventureWorks]
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
填充:纯色
=iif(Fields!Col_Key.Value=Parameters!pColMbr.Value
orFields!Row_Key.Value=Parameters!pRowMbr.Value,
"LemonChiffon",
Nothing
)
5、图表区属性
6、Value_LY序列属性
填充:纯色,银色
7、Value序列属性
跳转参数设计:
pRowHierarchy:[Row_Hierarchy_Name]
pRowMbr:[Row_Key]
pColHierarchy:[Col_Hierarchy_Name]
pColMbr:[Col_Key]
pCallingReport:[&ReportName]
填充:
= iif(Parameters!pHighIsGoodOrBad.Value="Good",
iif(Fields!Value.Value>Fields!Value_LY.Value,"Black","Red"),
iif(Fields!Value.Value>Fields!Value_LY.Value,"Red","Black")
)
边框:实线。
表达式:=iif(Fields!Date_Key.Value=Parameters!pDateMbr.Value,"2pt","0.5pt")
效果:
2.3.3.2 数据区
2.3.3.2.1 Value
提示:
=Fields!Measure_Label.Value+" was "
+FormatNumber(Last(Fields!Value.Value))
+" in "+Last(Fields!Date_Label.Value)
自定义格式:
=iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
iif(last(abs(Fields!Value.Value))>10000,"#, k;(#, k)",
iif(last(abs(Fields!Value.Value))>1000,"#,.0 k;(#,.0 k)",
"#,#;(#,#)"))))
2.3.3.2.2 Value_LY
提示:
=Fields!Measure_Label.Value+" was "
+FormatNumber(Last(Fields!Value_LY.Value))
+" in "+Last(Fields!DateLY_Label.Value)
自定义格式:
=iif(last(abs(Fields!Value_LY.Value))>10000000,"#,, m;(#,, m)",
iif(last(abs(Fields!Value_LY.Value))>1000000,"#,,.0 m;(#,,.0 m)",
iif(last(abs(Fields!Value_LY.Value))>10000,"#,#, k;(#,#, k)",
iif(last(abs(Fields!Value_LY.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
"#,#;(#,#)"))))
字体:
暗灰色
效果:
2.4 行-筛选器/行-列置换区
2.4.1 行-筛选器置换区
提示:
="swap "+Fields!Row_Hierarchy_Name.Value
+"(rows) with "+Fields!Filter_Hierarchy_Name.Value
+"(filter)"
字体:
加粗、青蓝色
调用报表:[&ReportName]。参数:
pCallingReport:[&ReportName]
pFilterMbr:[@pRowMbr]
pRowMbr:[@pFilterMbr]
2.4.3 行-列置换区
提示:
="swap "+Fields!Row_Hierarchy_Name.Value
+"(rows) with "+Fields!Col_Hierarchy_Name.Value
+"(columns)"
字体:
加粗、青蓝色
调用操作:[&ReportName]。参数:
pCallingReport:[&ReportName]
pColMbr:[@pRowMbr]
pRowMbr:[@pColMbr]
2.5 排序
数据集:
select‘1‘asValue,‘Top‘asValueName
union
select‘-1‘,‘Bottom‘
提示:
="show "+Fields!ValueName.Value+" values"
字体:
=iif(Parameters!pTopOrBottom.Value=Fields!value.Value,
"DimGray",
"CornflowerBlue"
)
调用操作:[&ReportName]。参数:
pTopOrBottom:[value]
列分组:
Value。
2.6 行/列数量
数据集:
Select5asCellCount
union all
select6
union all
select7
union all
select10
union all
select20
union all
select50
提示:
="show "+ str(Fields!CellCount.Value)+" columns"
字体:
=iif(Parameters!pColCount.Value=Fields!CellCount.Value,
"DimGray",
"CornflowerBlue"
)
调用操作:[&ReportName]。参数:
pColCount:[CellCount]
行或列分组:
CellCount
2.7 Lag
数据集:
Select2asLag
union all
select3
union all
select4
union all
select6
union all
select7
union all
select12
提示:
="show "+ str(Fields!Lag.Value)+" periods in Australian Sparkline"
字体:
=iif(Parameters!pLag.Value=Fields!Lag.Value,
"DimGray",
"CornflowerBlue"
)
调用操作:[&ReportName]。参数:
pLag:Lag
列分组:
Lag
2.8 日期、行、列、筛选器
2.8.1 度量
字体:
加粗、青蓝色
调用操作:Angry Koala Driver。参数:
pCallingReport:[&ReportName]
2.8.2 日期
- 值:
= left(First(Fields!Date_Label.Value),3)+" "
+ right(First(Fields!Date_Label.Value),4)+" - "
+ left(Last(Fields!Date_Label.Value),3)+" "
+ 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 浏览者、执行时间
="run by "&User!UserID+" in "+
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).TotalSeconds<1
,
"< 1 second",
(IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours>0
,System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours&" hour(s), "
,"")+
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes>0
,System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes&" minute(s), "
,"")+
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds>0
,System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds&" second(s)"
,"")
)
)
2.9.2 日期
=FormatDateTime(Globals!ExecutionTime,3)&" "&FormatDateTime(Globals!ExecutionTime,1)
2.9.3 页面编号
="Page "&Globals!PageNumber&" of "&Globals!TotalPages
2.9.4、报表信息
=Parameters!pDateMbr.Value+VbCrLf
+Parameters!pCube.Value+VbCrLf
+Parameters!pMeasureGroup.Value+VbCrLf
+Parameters!pMeasure.Value+VbCrLf
+Parameters!pRowMbr.Value+VbCrLf
+Parameters!pColMbr.Value+VbCrLf
+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 标题提示区
数据集:
-----------------------------------------------------------------------------
--GrantPaisley
--AngryKoala
--28Nov2008
-----------------------------------------------------------------------------
WITH
MEMBER [Measures].[Lag] AS
iif(left(@pLag,1)="[",12,StrToValue(@pLag))
MEMBER [Measures].[Measure_Label] AS
iif(left(@pMeasure,10)="[Measures]"
,StrToValue(@pMeasure+".Member_Name")
,StrToValue("[Measures].[Reseller Sales Amount].Member_Name")
)
MEMBER [Measures].[Value] AS
iif(left(@pMeasure,10)="[Measures]"
,StrToValue(@pMeasure)
,StrToValue("[Measures].[Reseller Sales Amount]")
)
MEMBER [Measures].[Value LY] AS
StrToValue("( [Measures].[Value], "+@pDateMbr
+".Hierarchy.CurrentMember.Lag("
+Str([Measures].[Lag])+")) "
)
MEMBER [Measures].[Date_Label] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Date_Key] AS
StrToValue(@pDateMbr+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Date_Level] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[DateLY_Label] AS
StrToValue(@pDateMbr+".Hierarchy.CurrentMember.Lag("
+Str([Measures].[Lag])+" ).Member_Caption "
)
MEMBER [Measures].[DateLY_Key] AS
StrToValue(@pDateMbr+".Hierarchy.Currentmember.Lag("
+Str([Measures].[Lag])+" ).Uniquename")
MEMBER [Measures].[RowFocus] AS
strtovalue(‘"‘+@pRowMbr+‘"‘)
MEMBER [Measures].[ColFocus] AS
strtovalue(‘"‘+@pColMbr+‘"‘)
MEMBER [Measures].[Row_Label] AS
StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Row_Key] AS
StrToValue(@pRowMbr+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Row_Level_Name] AS
StrToValue(@pRowMbr+".Hierarchy.Level.Name")
MEMBER [Measures].[Row_Level] AS
StrToValue(@pRowMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Row_Dimension_Name] AS
StrToValue(@pRowMbr+".Dimension.Name")
MEMBER [Measures].[Row_Hierarchy_Name] AS
StrToValue(@pRowMbr+".Hierarchy.Name")
MEMBER [Measures].[Col_Label] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Col_Key] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.UniqueName")
MEMBER [Measures].[Col_Level_Name] AS
StrToValue(@pColMbr+".Hierarchy.Level.Name")
MEMBER [Measures].[Col_Level] AS
StrToValue(@pColMbr+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Col_Dimension_Name] AS
StrToValue(@pColMbr+".Dimension.Name")
MEMBER [Measures].[Col_Hierarchy_Name] AS
StrToValue(@pColMbr+".Hierarchy.Name")
SELECT NON EMPTY {
[Measures].[Lag],
[Measures].[Date_Key],
[Measures].[Date_Label],
[Measures].[Date_Level],
[Measures].[DateLY_Key],
[Measures].[DateLY_Label],
[Measures].[Measure_Label],
[Measures].[RowFocus],
[Measures].[Row_Key],
[Measures].[Row_Label],
[Measures].[Row_Level],
[Measures].[Row_Level_Name],
[Measures].[Row_Hierarchy_Name],
[Measures].[Row_Dimension_Name],
[Measures].[ColFocus],
[Measures].[Col_Key],
[Measures].[Col_Label],
[Measures].[Col_Level],
[Measures].[Col_Level_Name],
[Measures].[Col_Hierarchy_Name],
[Measures].[Col_Dimension_Name],
[Measures].[Value],
[Measures].[Value LY]
} ON COLUMNS,
NON EMPTY {(
STRTOMEMBER(@pDateMbr):STRTOMEMBER(@pDateMbr+".lag("+Str([Measures].[Lag]-1)+")")
*STRTOSET("{"+[Measures].[ColFocus]+"}")
*STRTOSET("{"+[Measures].[RowFocus]+"}")
)}--DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME
ON ROWS
FROM [AdventureWorks]
WHERE STRTOMEMBER(@pFilterMbr)
--CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
3.2.1 度量
字体:
加粗,暗灰色
3.2.2 日期
值:
=left(First(Fields!Date_Label.Value),3)
+" - "
+ left(Last(Fields!Date_Label.Value),3)
+ 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 垂直轴属性
数字:自定义格式
=iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
iif(last(abs(Fields!Value.Value))>10000,"#,#, k;(#,#, k)",
iif(last(abs(Fields!Value.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
"#,#;(#,#)"))))
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
提示:
=Fields!Measure_Label.Value+" was "
+FormatNumber(Last(Fields!Value.Value))
+" in "+Last(Fields!Date_Label.Value)
数字:
=iif(last(abs(Fields!Value.Value))>10000000,"#,, m;(#,, m)",
iif(last(abs(Fields!Value.Value))>1000000,"#,,.0 m;(#,,.0 m)",
iif(last(abs(Fields!Value.Value))>10000,"#,#, k;(#,#, k)",
iif(last(abs(Fields!Value.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
"#,#;(#,#)"))))
填充:
白色
3.3.2.2 Value_LY
提示:
=Fields!Measure_Label.Value+" was "
+FormatNumber(Last(Fields!Value_LY.Value))
+" in "+Last(Fields!DateLY_Label.Value)
数字:
=iif(last(abs(Fields!Value_LY.Value))>10000000,"#,, m;(#,, m)",
iif(last(abs(Fields!Value_LY.Value))>1000000,"#,,.0 m;(#,,.0 m)",
iif(last(abs(Fields!Value_LY.Value))>10000,"#,#, k;(#,#, k)",
iif(last(abs(Fields!Value_LY.Value))>1000,"#,#,.0 k;(#,#,.0 k)",
"#,#;(#,#)"))))
字体:
暗灰色
3.3.3 对比报表
列分组:
Date_Key
Value/Value_LY数字自定义格式:
=iif(abs(Fields!Value.Value)>10000000,"#,, m;(#,, m)",
iif(abs(Fields!Value.Value)>1000000,"#,,.0 m;(#,,.0 m)",
iif(abs(Fields!Value.Value)>10000,"#, k;(#, k)",
iif(abs(Fields!Value.Value)>1000,"#,.0 k;(#,.0 k)",
"#,#;(#,#)"))))
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
查询:
="select * from $System.MDSCHEMA_CUBES WHERE CUBE_SOURCE = 1 AND [CATALOG_NAME] = ‘"
&Parameters!pDatabase.Value&"‘"
参数:
pDatabase:[@pDatabase]
4.2.3 Dimensions
查询:
="select * from $System.MDSCHEMA_DIMENSIONS WHERE CUBE_NAME = ‘"
&Parameters!pCube.Value&"‘"
值:
=iif(Parameters!pDriver.Value="pMeasure",
"Select a cube and measure",
iif(Parameters!pDriver.Value="pRowMbr",
"Select another hierarchy for Rows",
"Select another hierarchy for Columns"
)
)
4.2.4 Hierarachies
查询:
="select * from $System.MDSCHEMA_HIERARCHIES"
+" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
参数:
pCube:[@pCube]
pDimension:[@pDimension]
4.2.5 MeasureGroupDimensions
查询:
="Select * from $System.MDSCHEMA_MEASUREGROUP_DIMENSIONS "
+" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
+" AND MEASUREGROUP_NAME = ‘"&Parameters!pMeasureGroup.Value&"‘"
参数:
pCube:[@pCube]
pMeasureGroup:[@pMeasureGroup]
4.2.6 Level
查询:
="select * from $System.MDSCHEMA_LEVELS WHERE CUBE_NAME = ‘"
&Parameters!pCube.Value&"‘"
参数:
pCube:[@pCube]
4.2.7 MeasureGroups
查询:
="Select * from $System.MDSCHEMA_MEASUREGROUPS WHERE CUBE_NAME = ‘"
&Parameters!pCube.Value&"‘"
参数:
pCube:[@pCube]
4.2.8 Measures
查询:
="Select * from $System.MDSCHEMA_MEASURES"
+" WHERE CUBE_NAME = ‘"&Parameters!pCube.Value&"‘"
+" AND ( MEASUREGROUP_NAME = ‘"&Parameters!pMeasureGroup.Value&"‘"
+" OR MEASURE_DISPLAY_FOLDER = ‘"&Parameters!pMeasureGroup.Value&"‘ )"
参数:
pCube:[@pCube]
4.3 报表设计
4.3.1 标题
值:
=iif(Parameters!pDriver.Value="pMeasure",
"Select a cube and measure",
iif(Parameters!pDriver.Value="pRowMbr",
"Select another hierarchy for Rows",
"Select another hierarchy for Columns")
)
4.3.2 Dimensions
tablix属性:可见性
=iif(Parameters!pDriver.Value="pMeasure",True,False)
文本框属性:
值:
=right(
left(
Fields!DIMENSION_UNIQUE_NAME.Value,
len(Fields!DIMENSION_UNIQUE_NAME.Value)-1
),
len(Fields!DIMENSION_UNIQUE_NAME.Value)-2
)
填充:
=iif(Fields!DIMENSION_UNIQUE_NAME.Value=Parameters!pDimension.Value
,"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]
颜色:
蓝色
填充:
=iif(Fields!HIERARCHY_UNIQUE_NAME.Value=Parameters!pHierarchy.Value
,"LemonChiffon","White")
调用操作:[@pCallingReport]。参数:
pRowMbr:
=iif(Parameters!pDriver.Value="RowMbr",
Fields!DEFAULT_MEMBER.Value,
Parameters!pRowMbr.Value
)
pColMbr:
=iif(Parameters!pDriver.Value="ColMbr",
Fields!DEFAULT_MEMBER.Value,
Parameters!pColMbr.Value
)
pFilterMbr:
=iif(Parameters!pDriver.Value="FilterMbr",
Fields!DEFAULT_MEMBER.Value,
Parameters!pFilterMbr.Value
)
分组: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)
文本框属性:
填充:
=iif(Fields!MEASUREGROUP_NAME.Value=Parameters!pMeasureGroup.Value
,"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
--------------------------------------------------------------------
--GrantPaisley
--AngryKoala
--Nov2011
--------------------------------------------------------------------
WITH
MEMBER [Measures].[Mbr_Key] AS
iif(@pDriver="DateMbr",@pDateMbr,
iif(@pDriver="RowMbr",@pRowMbr,
iif(@pDriver="ColMbr",@pColMbr,
iif(@pDriver="FilterMbr",@pFilterMbr,@pDateMbr))))
MEMBER [Measures].[Measure_Label] AS
iif(left(@pMeasure,10)="[Measures]"
,StrToValue(@pMeasure+".Member_Name")
,StrToValue("[Measures].[Reseller Order Quantity].Member_Name"))
MEMBER [Measures].[Value] AS
iif(left(@pMeasure,10)="[Measures]"
,StrToValue(@pMeasure)
,StrToValue("[Measures].[Reseller Order Quantity]"))
MEMBER [Measures].[RowFocus] AS
strtovalue(‘"‘+[Measures].[Mbr_Key]+‘"‘)
MEMBER [Measures].[Row_Label] AS
StrToValue([Measures].[Mbr_Key]+".Hierarchy.CurrentMember.Member_Caption")
MEMBER [Measures].[Row_Key] AS
StrToValue([Measures].[Mbr_Key]+".Hierarchy.Currentmember.Uniquename")
MEMBER [Measures].[Row_Level_Name] AS
StrToValue([Measures].[Mbr_Key]+".Hierarchy.Level.Name")
MEMBER [Measures].[Row_Level] AS
StrToValue([Measures].[Mbr_Key]+".Hierarchy.CurrentMember.Level.Ordinal")
MEMBER [Measures].[Row_Hierarchy_Name] AS
StrToValue([Measures].[Mbr_Key]+".Hierarchy.Name")
MEMBER [Measures].[Row_Dimension_Name] AS ‘
StrToValue([Measures].[Mbr_Key]+".Dimension.Name")
MEMBER [MEASURES].MbrIsAncestor AS
Strtovalue("IsAncestor( "+[Measures].[Mbr_Key]+".hierarchy.currentmember, "+[Measures].[Mbr_Key]+" )"
+"or("+[Measures].[Mbr_Key]+".hierarchy.currentmember is "+[Measures].[Mbr_Key]+")"
)
SELECT NON EMPTY {
[Measures].[Measure_Label],
[Measures].[Mbr_Key],
[Measures].[RowFocus],
[Measures].[Row_Key],
[Measures].[Row_Label],
[Measures].[Row_Level],
[Measures].[Row_Level_Name],
[Measures].[Row_Hierarchy_Name],
[Measures].[Row_Dimension_Name],
[Measures].[MbrIsAncestor],
[Measures].[Value]
} ON COLUMNS,
NON EMPTY {(
STRTOSET("{"+
GENERATE(
ASCENDANTS(STRTOMEMBER([Measures].[RowFocus]))
,STRTOVALUE([Measures].[RowFocus]+".Hierarchy.CURRENTMEMBER.Uniquename")
,".siblings, "
)+".siblings,"
+[Measures].[RowFocus]+".children"
+"}")
)}
ON ROWS
FROM [AdventureWorks]
5.2.2 CellCount
Select5asCellCount
union all
select6
union all
select7
union all
select10
union all
select20
union all
select50
5.2.3 Lag
Select2asLag
union all
select3
union all
select4
union all
select6
union all
select12
5.3 标题
="Select "+First(Fields!Row_Hierarchy_Name.Value,"DataSet1")+" member"
5.4 报表区
列分组:
5.4.1 Row_Label
行分组:
文本框属性:
调用操作:[@pCallingReport]。参数:
pDateMbr:
=iif(Parameters!pDriver.Value="DateMbr"
,Fields!Row_Key.Value
,Parameters!pDateMbr.Value)
pRowMbr:
=iif(Parameters!pDriver.Value="RowMbr"
,Fields!Row_Key.Value
,Parameters!pRowMbr.Value)
pColMbr:
=iif(Parameters!pDriver.Value="ColMbr"
,Fields!Row_Key.Value
,Parameters!pColMbr.Value)
pFilterMbr:
=iif(Parameters!pDriver.Value="FilterMbr"
,Fields!Row_Key.Value
,Parameters!pFilterMbr.Value)
5.4.2 右边表达式
值:
=iif(Fields!MbrIsAncestor.Value,
"+ ==>",
"+"
)
调用操作:[&ReportName]。参数:
pDateMbr:
=iif(Parameters!pDriver.Value="DateMbr"
,Fields!Row_Key.Value
,Parameters!pDateMbr.Value)
pRowMbr:
=iif(Parameters!pDriver.Value="RowMbr"
,Fields!Row_Key.Value
,Parameters!pRowMbr.Value)
pColMbr:
=iif(Parameters!pDriver.Value="ColMbr"
,Fields!Row_Key.Value
,Parameters!pColMbr.Value)
pFilterMbr:
=iif(Parameters!pDriver.Value="FilterMbr"
,Fields!Row_Key.Value
,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