简体   繁体   English

从Spotfire中的另一行检索值

[英]Retrieving Value from Another Row in Spotfire

I am attempting to reference a value in another row for a particular column of data in Spotfire. 我试图在Spotfire中为特定的数据列引用另一行中的值。 As an example, I would like to reference the sales month where the quantity of sales of bronze widgets was equal to the number of Gold Widgets. 举个例子,我想参考销售月份,其中青铜小工具的销售数量等于黄金小工具的数量。 I've included a column below to show the data I need, "Month Where Bronze Sales = Gold Sales" 我在下面列了一个列,以显示我需要的数据,“铜销售月份=黄金销售额”

Sales Month        Cumulative Bronze Widgets             Cumulative Gold Widgets              Month Where Bronze Sales = Gold Sales
   1/1/2017                                     0                                 1                                              2/1/2017
   2/1/2017                                     1                                 2                                              4/1/2017
   3/1/2017                                     1                                 2                                              4/1/2017
   4/1/2017                                     2                                 3                                              5/1/2017
   5/1/2017                                     3                                 3                                              5/1/2017
   6/1/2017                                     4                                 3                                              5/1/2017

I need to accomplish this with an expression without using a script or inserting another table. 我需要使用表达式来完成此操作而不使用脚本或插入另一个表。 Is this possible? 这可能吗? I've tried the following and other "Over" functions without success for "Month Where Bronze Sales = Gold Sales" 我已经尝试过以下和其他“结束”功能但没有成功“青铜销售=黄金销售的月份”

Case When Max([Cumulative Bronze Widgets]) over ([Sales Month])= [Cumulative Gold Widgets] Then Max([Sales Month]) Over ([Cumulative Bronze Widgets]) else NULL End

Spotfire supports getting data from another rows through OVER formulas. Spotfire支持通过OVER公式从其他行获取数据。 That requires a common value in the SAME COLUMN of the current row and the one where you get the data from. 这需要当前行的SAME COLUMN中的公共值以及从中获取数据的公共值。

You need to match values in different columns, so OVER won't work for you. 您需要匹配不同列中的值,因此OVER将不适合您。

You can try some workarounds: 你可以尝试一些解决方法:

1. Separate column for each Cumulative Bronze Widgets 1.每个Cumulative Bronze Widgets单独列

This works if you expect only a few numbers of Cumulative Bronze Widgets : 如果你只想要几个Cumulative Bronze Widgets

  • "Cumulative Bronze Widgets - 1": “累积青铜小工具 - 1”:
    Min(IF([Cumulative Bronze Widgets]=1,[Sales Month],Null))
  • "Cumulative Bronze Widgets - 2": “累积青铜小部件 - 2”:
    Min(IF([Cumulative Bronze Widgets]=2,[Sales Month],Null))
  • ... ...
  • "Month Where Bronze Sales = Gold Sales": “青铜销售月份=黄金销售额”:
    Case When [Cumulative Gold Widgets] then [Cumulative Bronze Widgets - 1]
    When [Cumulative Gold Widgets] then [Cumulative Bronze Widgets - 1]
    ....
    End

2. Create a new table 2.创建一个新表

  • Create a new cross table visualization for Bronze widgets vs sales month 为Bronze小部件与销售月创建新的交叉表可视化
  • save this new visualization as a new table 将此新可视化保存为新表
  • create a link between old and new tables ([original table].[gold widgets] = [new table].[bronze widgets] 在旧表和新表之间创建一个链接([原始表]。[gold widgets] = [new table]。[bronze widgets]
  • you can now filter the original table by filtering the new one; 您现在可以通过过滤新表来过滤原始表; unfortunately you can include data from multiple tables in the same visualization. 遗憾的是,您可以在同一个可视化中包含多个表中的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM