0

我使用交叉表控件创建了一个报告,该控件按列中的日期对数据进行分组。我想获取早于本月 1 日(运行报告时)的所有日期,并将它们和汇总的数据合并到一个名为“上一个”的列中。

所以不要看到这样的东西:

Oct Nov Dec Jan Feb Mar Apr May Jun Jul

我见过这样的事情:

Previous Jan Feb Mar Apr May Jun Jul

在 CR XI 中有没有办法做到这一点?

4

2 回答 2

1

您必须创建一个公式来执行此操作(或者可能有两个公式,一个以正确的顺序获取它们,另一个用于显示正确的字符串):

分组公式:if {table.datefield} < currentdate then '0000' else cStr({table.datefield}, 'yyMM')

显示公式:if {table.datefield} < currentdate then 'Previous' else cStr({table.datefield}, 'MMM')

添加的屏幕截图

在此处输入图像描述

在此处输入图像描述

于 2013-01-09T09:42:56.520 回答
0

答案实际上是对李的答案的修改。

if {Command.ReqDate} < date(year({?StartDate}),month({?StartDate}),1) then dateadd('m',-1,{?StartDate}) else {Command.ReqDate}

use this to group on in the CT set to monthly
right click on the column header
select Format field,
select common tab
select display string formula
if currentfieldvalue < date(year({?StartDate}),month({?StartDate}),1) then 'previous' 
else totext(currentfieldvalue,'MMM')
于 2013-01-29T17:51:59.930 回答