Cognos计算方差交叉表(关系) [英] Cognos Calculate Variance Crosstab (Relational)

查看:191
本文介绍了Cognos计算方差交叉表(关系)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的交叉表,例如:

I have a simple crosstab such as this:

Trans     |    Pants    |    Shirts   |
          | 2013 | 2014 | 2013 | 2014 |
---------------------------------------
Jan       | 33   |  37  |  41  |  53  |
Feb       | 31   |  33  |  38  |  43  |
Mar       | 26   |  29  |  51  |  56  |




  • 裤子和衬衫属于数据项:类别

    年份属于数据项:年份

    月属于数据项:

    交易(交易)属于数据项: 交易

    Trans (transactions) belongs to the data item: Trans

    这是报表工作室的样子:

    Here is what is looks like in report studio:

    Trans     |      <#Category#>     |      <#Category#>     |
              | <#Years#> | <#Years#> | <#Years#> | <#Years#> |
    -----------------------------------------------------------
    <#Months#>|  <#1234#> |  <#1234#> | <#1234#>  | <#1234#>  |
    

    我希望能够计算出岁月中裤子和衬衫的差异。要获得这样的信息:

    I want to be able to calculate the variance of pants and shirts between the years. To get something like this:

    Trans     |           Pants            |           Shirts           |
              | 2013 | 2014 | YOY Variance | 2013 | 2014 | YOY Variance |
    ---------------------------------------------------------------------
    Jan       | 33   |  37  |     12.12    | 41   |  53  |     29.27    |
    Feb       | 31   |  33  |     6.45     | 38   |  43  |     13.16    |
    Mar       | 26   |  29  |     11.54    | 51   |  56  |     9.80     |
    

    我尝试使用以下表达式为YOY Variance插入数据项,以查看是否可以甚至可以获得2014年的值,但由于某种奇怪的原因而无法返回2013年的值:

    I've tried inserting a data item for YOY Variance with the expression below just to see if I can even get the 2014 value but cannot, some odd reason it only returns the 2013 values:

    Total([Trans] for maximum[Year],[Category],[Months])
    

    有什么想法吗?帮帮我?

    Any ideas? Help?

    推荐答案

    (我假设您没有DMR。)

    (I'm assuming you don't have a DMR.)

    在Cognos中没有简单/干净的方法可以做到这一点。在查询中,您必须为输出中的每一年建立一个计算。因此,2013年类似这样:

    There is no easy/clean way to do this in Cognos. In your query, you'll have to build a calculation for each year in your output. So, something like this for 2013:

    total (if [Years] = 2013) then ([Trans]) else (0))
    

    与2014年基本相同。

    And basically the same for 2014.

    将Trans片断从crossab中切除。然后,您将根据自己的年份嵌套这两个计算。要摆脱所有零或空值,请选择两列。从菜单中选择数据
    禁止仅禁止列

    Cut the Trans piece out of your crossab. Then you'll nest those two calcs under your years. To get rid of all the zeroes or nulls, select the two columns. From the menu, select Data, Suppress,Suppress Columns Only.

    最后,您将在交叉表中的Years旁边放置一个calc(不在它们的下面)。表达式将为([2014 trans]-[2013 trans])/ [2014 trans] (或最终命名计算的任何内容)。

    Finally, you will drop a calc in next to your Years in the crosstab (not under them). The expression will be ([2014 trans] - [2013 trans])/[2014 trans] (or whatever you end up naming your calcs). Format it as a percent, and you should be good to go.

    告诉您这很痛苦!

    这篇关于Cognos计算方差交叉表(关系)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆