现在的位置: 首页 > 综合 > 正文

BW: query分析实例(condition的使用)[整理]

2013年08月20日 ⁄ 综合 ⁄ 共 6172字 ⁄ 字号 评论关闭

在BW 报表的设计中,由于使用了各种特性,报表结果的数据有时可能不是你所预想的结果,甚至看上去是错误的。在这种情况下,我们应该怎么来分析、理解这些报表结果呢?以下是一个使用condition后BW报表的实例,通过这个例子,我们可以看到分析报表结果的一些基本技巧,并理解condition的工作原理。

话说某年某月的某一天,我们看到这样一个报表结果:

这个报表的意义是一目了然的,即我们现在有的数据是,在C02这个国家颜色为3的F07部件有760个,注意我们只有颜色为3的数据。

这时对这个报表下钻,筛选component为F07的所有结果,即在F07上右击鼠标,选择'fix filter value to Axis',就可以设置filter:component=F07如下:

这时得到的报表结果非常出人意外,我们看到:

突然我们多出了颜色为2的数据。这看上去很不合理,因为在原有数据结果的基础上进一步删选component=F07,所得到的结果应该完全与前面的报表结果一致,即760个数量才对。现在突然多了一条数据结果,这是非常奇怪的。

这时,我们通常应该看一看该报表里面有没有设置了一些特殊的东西。首先应当看一下条件(condition)的设置,因为condition会对报表的结果做特殊的选取。

在这个报表中,我们会看到,有一个condition是在激活状态。

具体查看这个condition的定义,我们会看到它是这样的:

它所表示的是,基于颜色和国家的组合,只显示key figure FABC_STZ<>0的结果,为0的结果将被屏蔽掉。

所谓基于颜色和国家的组合,即该condition只在颜色和国家同时下钻(drill down)的情况下,并且颜色与国家彼此相邻时才起作用。

此时,如果我们要理解报表的工作机制,我们就应该关掉这个condition,然后考察一下没有condition作用时的实际数据状态。把condition关闭后,我们看到报表的实际数据状态时这样的:

这里我们会看到,实际上颜色3和2其实本来都有数据,只是由于颜色2国家C02的FABC_STZ数量总和是0,这个组合就被condition屏蔽掉了。这是conditon的正确工作方式,具体可以参看online help里的说明:

condition的10条基本规则

具体针对这个例子,请看Rule 6,以及给出的例子来解释condition的设计逻辑:基于特性组合的condition

当我们增加了额外的filter component=F07的时候,报表的实际结果是:

此时,颜色2和国家C02的组合结果就不再是0了,我们就得到了不同的结果。

至此,我们看到,实际上报表的结果是正确的,只是由于condition的使用,看上去有些出乎意料。

要理解SAP关于condition的设计逻辑,一个更好的途径是在BW7.x(SPS 15以上)系统上运行事物代码RSFC,里面在Analytic Engine下面你可以找到所有关于condition的demo报表,你可以运行这些报表来真正理解前面所提到的系统设计原则。

如何使用RSFC,参看Note 1508237,Note 1133936。

   

源文档 <http://scnblogs.techweb.com.cn/giselle/archives/8.html>

   

   

最后,把文中提到的10 roles of condition 帖一下,挺好。

   

Basics and Example Scenarios for Conditions

Use

In this section, the basis for using conditions is explained and illustrated by means of example scenarios.

Overview

Note that the system processes conditions according to the following rules:

· Rule 1: If you apply conditions to a query, you are not changing any numbers. Instead, you are just hiding the numbers that are not relevant for you. This means that conditions do not effect results rows. The results row of a query with an active condition corresponds to the results row of the query without a condition.

See Ranked List Condition: Top 5 Products

注:condition只是隐藏内容,对数据合计不影响,想操作合计就控制Calculate Results as Summation

· Rule 2: Multiple conditions in a query are logically linked by means of AND. Conditions are evaluated independently of each other. In doing so, the results quantity for the evaluation sequence is independent. The intersection of conditions is displayed in the query. A characteristic value is only displayed if it fulfills all (active) conditions of the query.

See Linking to Conditions: Bottom 2 Revenue and Invoiced Quantity > 100.000.000

注:多个condition之间是AND

· Rule 3:The condition rows for a condition are logically linked with OR. The union of conditions row results is displayed in the query. A characteristic value is displayed if it fulfills at least one of the condition rows.

See Ranked List Condition with Two Condition Rows: Top 2 Products and Bottom 2 Products.

注:单个condition的行之间是OR

· Rule 4: The setting All Characteristics in Drilldown Independent means that each characteristic of the drilldown has a condition (identical) defined for it. These conditions are linked with AND according to rule 2. The setting All Characteristics in Drilldown Independent enables you to be able to use a condition in a general way. It is especially useful for threshold value conditions with relative key figures and ranked list conditions.

See Ranked List Condition for All Characteristics in Drilldown Independent: Top 3 Products and Top 3 Sales Channels and Conditions for All Characteristics in Drilldown Independent.

注:All Characteristics in Drilldown Independent 意味着对所有的characteristic都进行限制,如Top 3的意思就是所有characteristicdrilldown都是Top 3

· Rule 5: If a condition For All Characteristics in Drilldown Independent is active in a query and results row suppression is active for some characteristics, the system still generates all results and applies the condition(s) to each of these results levels according to rule 4.

See Query with Condition and Results Row Suppression

注:result row?!

· Rule 6: With several characteristics, the setting Single Characteristics and Characteristic Combinations always stands for the combination of these characteristics and not for a set of (independent) characteristics. A condition on a combination of characteristics is only applied when the following prerequisites have been fulfilled:

¡ Both characteristics are in the drilldown.

¡ Both characteristics are on the same axis.

¡ The two characteristics are next to one another.

¡ The axis upon which the two characteristics are drilled down has no hierarchical display (see Query with Hierarchically Displayed Axis and Conditions.)

¡ If one of the two characteristics has an active presentation hierarchy, only one threshold condition can be applied for the characteristic combinations, but not a ranked list condition (see Query with a Presentation Hierarchy and Conditions).

The system attempts to adapt the list display to these prerequisites by automatically activating the results row suppression (see Background Information for Conditions, section Conditions on Characteristic Combinations).

See Ranked List Condition for Characteristic Combination: Top 10 Combinations from Product and Sales Channel

注:这里的几个条件需要遵守!

· Rule 7 Ranked list conditions cannot be applied to characteristics with active presentation hierarchies.

See Query with a Presentation Hierarchy and Conditions and Query with Two Presentation Hierarchies and Conditions.

· Rule 8: In a cross-classified table (meaning characteristics are not only in the rows, but also in the columns), conditions are only applied to the axes. The axes span across the border of the matrix and all cells are displayed for which both the rows and the columns correspond to the active conditions.

See Threshold Condition for a Characteristic in a Cross-Classified Table

· Rule 9: If there are several characteristics in the drilldown and if a results row on this multi-level drilldown list does not fulfill the conditions and is then filtered out, then all of the associated detail rows and detailed (interim) results rows disappear.

See Conditions for All Characteristics in Drilldown Independent

注:这个其实说的就是上文的情况

· Rule 10: If a threshold value condition is applied to a characteristic with an active presentation hierarchy, then a node that actually does not fulfill the condition and would normally be filtered out is shown anyway if at least one of the subordinate nodes fulfills the condition.

The same is valid for

¡ Conditions on characteristic combinations if the (interim) results rows are being displayed

¡ Conditions on hierarchically displayed axes

See Query with a Presentation Hierarchy and Conditions and Query with Two Presentation Hierarchies and Conditions.

See also:

For more information on the application of conditions in queries with two structures, active presentation hierarchies and hierarchically displayed axes, see Basics and Example Scenarios for Conditions.

   

源文档 <http://help.sap.com/saphelp_nw70/helpdata/en/1e/7875a998bc44409f6002e28552685a/content.htm>

抱歉!评论已关闭.