简体   繁体   English

TIBCO Spotfire-插入计算的行

[英]TIBCO Spotfire - Insert Calculated Row

I'm trying to insert rows to the table in Spotfire that are a sum of existing rows 我正在尝试向Spotfire中的表插入行,这些行是现有行的总和

Existing Table: 现有表:

ID  SUB_ID  Line  Quarter  Value   
1   123     A     1        1  
1   123     A     2        2  
1   123     B     1        3  
1   123     B     2        4  
1   124     A     1        5  
1   124     A     2        6  
1   124     B     1        7  
1   124     B     2        8  
2   123     A     1        9  
2   123     A     2        1  
2   123     B     1        2  
2   123     B     2        3  
2   124     A     1        4  
2   124     A     2        5  
2   124     B     1        6  
2   124     B     2        7  

Rows to Add: 要添加的行:

ID  SUB_ID  Line  Quarter  Value (sum)
1   123     A     2        3  
1   123     B     2        7  
1   124     A     2        11  
1   124     B     2        15  
2   123     A     2        10  
2   123     B     2        5  
2   124     A     2        9  
2   124     B     2        13  

What is the best way to do this? 做这个的最好方式是什么?

the steps to implement the suggestion Monte_fisto made are outlined in another answer . 另一个答案中概述了实现Monte_fisto的建议的步骤。 make sure that you add the column as a transformation (Insert>Transformations...) rather than as a calculated column or you won't be able to use it as an index for the join. 确保将列添加为转换 (Insert> Transformations ...)而不是计算列,否则您将无法将其用作联接的索引。

another potential solution is to insert a calculated column with an expression like: 另一个可能的解决方案是插入一个带有以下表达式的计算列:

Sum([Value]) OVER Intersect([ID], [SUB_ID], [Line])

and then having your visualization measure that column. 然后让您的可视化工具测量该列。

it really depends on what you're going to do with your new data. 这实际上取决于您将如何处理新数据。 if you provide some more detail I'll try to answer more specifically. 如果您提供更多详细信息,我将尝试更具体地回答。

You can also create a pivoted derived table if you want to preserve your original table. 如果要保留原始表,也可以创建数据透视表。 Otherwise, just add a pivoted tranformation (insert > transformation) 否则,只需添加数据透视转换(插入>转换)

File > Add data table > Add > From current Analysis > your Table 文件>添加数据表>添加>来自当前分析>您的表

在此处输入图片说明

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

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