cognos报表数据项表达式函数的应用.docx

上传人:b****2 文档编号:23551191 上传时间:2023-05-18 格式:DOCX 页数:53 大小:28.98KB
下载 相关 举报
cognos报表数据项表达式函数的应用.docx_第1页
第1页 / 共53页
cognos报表数据项表达式函数的应用.docx_第2页
第2页 / 共53页
cognos报表数据项表达式函数的应用.docx_第3页
第3页 / 共53页
cognos报表数据项表达式函数的应用.docx_第4页
第4页 / 共53页
cognos报表数据项表达式函数的应用.docx_第5页
第5页 / 共53页
点击查看更多>>
下载资源
资源描述

cognos报表数据项表达式函数的应用.docx

《cognos报表数据项表达式函数的应用.docx》由会员分享,可在线阅读,更多相关《cognos报表数据项表达式函数的应用.docx(53页珍藏版)》请在冰豆网上搜索。

cognos报表数据项表达式函数的应用.docx

cognos报表数据项表达式函数的应用

文档编号

CCBBI_PM061110_001

版本号

密级

内部资料

cognos报表数据项表达式函数的应用手册

文档信息

项目名称

北京建总行ERPF报表项目

项目经理

张成浩

文档名称

cognos报表数据项表达式函数的应用手册

批复信息

负责人

日期

意见

拟制

/

审核

批准

文件控制

!

版本记录

日期

作者

版本

变更说明

2006-11-10

郑广珠

审阅记录

日期

审阅者

`

意见

/

分发记录

日期

接受人

地点

<

1引言

1.1编写目的

整理cognos的reportstudio中在数据项表达式中比较常用的函数的应用。

并可供以后需要用到的同事参考。

1.2背景

在开发报表过程中积累的一些经验和总结。

1.3参考资料

Cognos中的帮助文档和oracle的参考文档。

1.4术语定义及说明

 

2汇总函数

2.1aggregate

用法:

aggregate(expr[auto]) 

aggregate(exprfor[all|any]expr{,expr})

aggregate(exprforreport) 

作用:

根据表达式的聚合类型,返回使用相应的聚合函数计算得出的值。

Example:

aggregate([本期余额])

根据数据项[本期余额]的聚合类型,返回使用相应的聚合函数计算得出的值。

如果[本期余额]是sum()得到,则返回所有[本期余额]的合计。

2.2average

用法:

average([distinct]expr[auto])

average([distinct]exprfor[all|any]expr{,expr}) 

average([distinct]exprforreport)

作用:

返回选定数据项的平均值。

关键字distinct的作用是,当某个数据项有多个重复的项时,当中只有一个数据项有效。

Example:

average([本期余额])

返回所有[本期余额]的平均值

2.3count

用法:

count([distinct]expr[auto]) 

count([distinct]exprfor[all|any]expr{,expr}) 

count([distinct]exprforreport) 

作用:

返回选定数据项的数量,但不包括NULL值。

关键字distinct的作用是,当某个数据项有多个重复的项时,当中只有一个数据项有效。

Example:

count([行号])

返回所有[行号]总的数量。

2.4maximum

用法:

maximum([distinct]expr[auto]) 

maximum([distinct]exprfor[all|any]expr{,expr}) 

maximum([distinct]exprforreport) 

作用:

返回选定数据项的最大值。

关键字distinct的作用是,当某个数据项有多个重复的项时,当中只有一个数据项有效。

Example:

Maximum([本期余额])

返回数据项[本期余额]中的最大值。

2.5median

用法:

median(expr[auto]) 

median(exprfor[all|any]expr{,expr}) 

median(exprforreport)

作用:

返回选定数据项的中间值。

Example:

median([本期余额]) 

返回数据项[本期余额]中的中间值

2.6minimum

用法:

minimum([distinct]expr[auto]) 

minimum([distinct]exprfor[all|any]expr{,expr}) 

minimum([distinct]exprforreport) 

作用:

返回选定数据项的最小值。

关键字distinct的作用是,当某个数据项有多个重复的项时,当中只有一个数据项有效。

Example:

minimum([本期余额])

返回数据项[本期余额]中的最小值

2.7moving-average

用法:

moving-average(numeric_expr,numeric_expr[atexp{,expr}][][prefilter]) 

moving-average([distinct]numeric_expr,numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回指定的一组值在指定行数上的移动平均值。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

moving-average([本期余额],3)

对应的每一行,返回当前行的数量值和当前行与前面两行共三行的平均值为当前行的一组值

本期余额

moving-average([本期余额],3)

200

NULL

700

NULL

400

200

200

500

2.8moving-total

用法:

moving-total(numeric_expr,numeric_expr[atexp{,expr}][][prefilter]) 

moving-total([distinct]numeric_expr,numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回指定的一组值在指定行数上的移动合计。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

moving-total([本期余额],3)

对应的每一行,返回当前行的数量值和当前行与前面两行共三行的合计为当前行的一组值

本期余额

moving-total([本期余额],3)

200

NULL

700

NULL

400

1300

200

1300

200

800

500

900

2.9percentage

用法:

percentage(numeric_expr[atexp{,expr}][][prefilter]) 

percentage([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

返回选定数据项占合计值的百分比。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

percentage([本期余额])

返回每行[本期余额]的值所占总数的百分比

2.10percentile

用法:

percentile(numeric_expr[atexp{,expr}][][prefilter])

percentile([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto

作用:

返回在100范围内的某一值,用于表示等于或低于选定数据项的一部分所占百分比。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

percentile([本期余额])

对应的每一行,返回表示等于或低于该行数据量的百分比

本期余额

percentile([本期余额])

800

1

700

600

500

400

400

200

200

2.11quantile

用法:

quantile(numeric_expr,numeric_expr[atexp{,expr}][][prefilter])

quantile([distinct]numeric_expr,numeric_expr[][prefilter])

:

:

=forexpr{,expr}|forreport|auto

作用:

以指定范围的形式返回值的排名。

它返回整数,以表示排名的任何范围,例如从1(最高)到100(最低)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

quantile([本期余额],4) 

对应的每一行,返回该行[本期余额]的数量值、[本期余额]数量值的排名以及所有[本期余额]数量值分成4部分后的排名。

本期余额

Rank([本期余额])

quantile([本期余额],4)

800

1

1

700

2

1

600

3

2

500

4

2

400

5

3

400

5

3

200

7

4

200

7

4

2.12quartile

用法:

quartile(numeric_expr[atexp{,expr}][][prefilter]) 

quartile([distinct]numeric_expr[][prefilter])

:

:

=forexpr{,expr}|forreport|auto

作用:

返回某一值相对于一组值的排名,由1(最高)到4(最低)之间的整数表示。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

quartile([本期余额])

对应的每一行,返回该行[本期余额]的数量值和[本期余额]的数量值分成四部分后的排名,由1(最高)到4(最低)之间的整数表示。

本期余额

quartile([本期余额])

450

1

400

1

350

2

300

2

250

3

200

3

150

4

100

4

2.13rank

用法:

rank(expr[sort_order]{,expr[sort_order]}[atexp{,expr}][][prefilter]) 

rank([distinct]expr[sort_order]{,expr[sort_order]}[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto

作用:

返回选定数据项的排名值。

如果两个或多个行排名相同,则排名值(也称为Olympic排名)顺序中会存在一个缺口。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

rank([本期余额])

返回[本期余额]数据项的数据量排名值

本期余额

rank([本期余额])

60000

1

50000

2

50000

2

40000

4

2.14running-average

用法:

running-average(numeric_expr[atexp{,expr}][][prefilter]) 

running-average([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto

作用:

按行返回一组值的运行平均值(包括当前行)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-average([本期余额])

对应的每一行,返回[本期余额]当前行与其前面所有行的平均值。

描述

本期余额

AVG

running-averageFOR描述

现金

7

5

7

现金

3

5

5

现金

6

5

现金

4

5

5

存款

3

4

3

存款

5

4

4

2.15running-count

用法:

running-count(numeric_expr[atexp{,expr}][][prefilter]) 

running-count([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回一组值的运行计数(包括当前行)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-count([本期余额])

对应的每一行,返回[本期余额]当前行在所有行的位置计数。

描述

本期余额

COUNT

running-countFOR描述

现金

7

4

1

现金

3

4

2

现金

6

4

3

现金

4

4

4

存款

3

2

1

存款

5

2

2

2.16running-difference

用法:

running-difference(numeric_expr[atexp{,expr}][][prefilter]) 

running-difference([distinct]numeric_expr[][prefilter])

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回一组值的运行差额,该运行差额为当前行的值与前面行(包括当前行)的值之间的差额。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-difference([本期余额])

对应的每一行,返回[本期余额]当前行与前面行的值之间的差额

描述

本期余额

running-differenceFOR描述

现金

7

NULL

现金

3

-4

现金

6

3

现金

4

-2

存款

3

-1

存款

5

2

2.17running-maximum

用法:

running-maximum(numeric_expr[atexp{,expr}][][prefilter]) 

running-maximum([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回一组值的最大运行值(包括当前行)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-maximum([本期余额])

对应的每一行,返回[本期余额]当前行与前面所有行的最大值

描述

本期余额

MAX

running-maximumFOR描述

现金

2

7

2

现金

3

7

3

现金

6

7

6

现金

7

7

7

存款

3

5

3

存款

5

5

5

2.18running-minimum

用法:

running-minimum(numeric_expr[atexp{,expr}][][prefilter]) 

running-minimum([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回一组值的最小运行值(包括当前行)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-minimum([本期余额])

对应的每一行,返回[本期余额]当前行与前面所有行的最小值

描述

本期余额

Min

running-minimumFOR描述

现金

7

2

7

现金

3

2

3

现金

6

2

3

现金

2

2

2

存款

3

3

3

存款

5

3

3

2.19running-total

用法:

running-total(numeric_expr[atexp{,expr}][][prefilter]) 

running-total([distinct]numeric_expr[][prefilter]) 

:

:

=forexpr{,expr}|forreport|auto 

作用:

按行返回一组值的运行合计(包括当前行)。

定义函数范围。

atoption定义聚合级别,只能在关系数据源上下文中使用。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

running-total([本期余额]) 

对应的每一行,返回[本期余额]当前行与前面所有行的数据值的合计。

描述

本期余额

TOTAL

running-totalFOR描述

现金

7

18

7

现金

3

18

10

现金

6

18

16

现金

2

18

18

存款

3

8

3

存款

5

8

8

2.20standard-deviation

用法:

standard-deviation([distinct]expr[auto]) 

standard-deviation([distinct]exprfor[all|any]expr{,expr}) 

standard-deviation([distinct]exprforreport) 

作用:

返回选定数据项的标准偏差。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

standard-deviation([本期余额]) 

返回[本期余额]数据项对应的标准偏差

2.21standard-deviation-pop

用法:

standard-deviation-pop([distinct]expr[auto])

standard-deviation-pop([distinct]exprfor[all|any]expr{,expr}) 

standard-deviation-pop([distinct]exprforreport) 

作用:

计算总体标准偏差并返回总体方差的平方根。

关键字distinct的作用是,当某个行有多个重复的行时,当中只有一个行有效。

Example:

2.22total

用法:

total([distinct]expr[auto]) 

total([distinct]exprfor[all|any]expr{,expr}) 

total([dis

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1