spotfire 如何在计算列中显示趋势
spotfire how to show a trend in a calculted column
我有这样的数据table。我如何创建一个计算列来显示数量是否在增加?说如果最后一个数量高于倒数第二个数量,那么结果应该为真否则为假。
最终,我想用一个图形table和一个图标来表示它。
谢谢
这里有两个答案,具体取决于您是想按产品查看还是仅查看整个数据集。
按产品
- 插入计算列:
Rank([Date],"asc",[Product]) as [ProductRowNumber]
- 插入计算列:
If([Quantity]>Min([Quantity]) over (Intersect([Product],Previous([ProductRowNumber]))),"TRUE","FALSE")
忽略产品(整个数据集)
插入计算列:Rank([Date],"asc") as [RowNumber]
插入计算列:If([Quantity]>Min([Quantity]) over (Previous([RowNumber])),"TRUE","FALSE")
结果
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+
| Date | Product | Quantity | ProductRowNumber | IncreasingProduct | RowNumber | IncreasingEntireDataSet |
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+
| 11/01/2016 | a | 0 | 1 | | 1 | |
| 11/02/2016 | a | 1 | 2 | TRUE | 2 | TRUE |
| 11/03/2016 | a | 2 | 3 | TRUE | 3 | TRUE |
| 11/04/2016 | a | 3 | 4 | TRUE | 4 | TRUE |
| 11/05/2016 | a | 4 | 5 | TRUE | 5 | TRUE |
| 11/06/2016 | a | 5 | 6 | TRUE | 6 | TRUE |
| 11/07/2016 | a | 6 | 7 | TRUE | 7 | TRUE |
| 11/08/2016 | a | 7 | 8 | TRUE | 8 | TRUE |
| 11/09/2016 | a | 8 | 9 | TRUE | 9 | TRUE |
| 11/10/2016 | a | 9 | 10 | TRUE | 10 | TRUE |
| 11/11/2016 | a | 10 | 11 | TRUE | 11 | TRUE |
| 11/12/2016 | b | 0 | 1 | | 12 | FALSE |
| 11/13/2016 | b | 1 | 2 | TRUE | 13 | TRUE |
| 11/14/2016 | b | 2 | 3 | TRUE | 14 | TRUE |
| 11/15/2016 | b | 3 | 4 | TRUE | 15 | TRUE |
| 11/16/2016 | b | 4 | 5 | TRUE | 16 | TRUE |
| 11/17/2016 | b | 5 | 6 | TRUE | 17 | TRUE |
| 11/18/2016 | b | 4 | 7 | FALSE | 18 | FALSE |
| 11/19/2016 | b | 3 | 8 | FALSE | 19 | FALSE |
| 11/20/2016 | b | 2 | 9 | FALSE | 20 | FALSE |
| 11/21/2016 | b | 3 | 10 | TRUE | 21 | TRUE |
| 11/22/2016 | c | 0 | 1 | | 22 | FALSE |
| 11/23/2016 | c | 1 | 2 | TRUE | 23 | TRUE |
| 11/24/2016 | c | 2 | 3 | TRUE | 24 | TRUE |
| 11/25/2016 | c | 3 | 4 | TRUE | 25 | TRUE |
| 11/26/2016 | c | 2 | 5 | FALSE | 26 | FALSE |
| 11/27/2016 | c | 1 | 6 | FALSE | 27 | FALSE |
| 11/28/2016 | c | 2 | 7 | TRUE | 28 | TRUE |
| 11/29/2016 | c | 2 | 8 | FALSE | 29 | FALSE |
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+
我有这样的数据table。我如何创建一个计算列来显示数量是否在增加?说如果最后一个数量高于倒数第二个数量,那么结果应该为真否则为假。
最终,我想用一个图形table和一个图标来表示它。
谢谢
这里有两个答案,具体取决于您是想按产品查看还是仅查看整个数据集。
按产品
- 插入计算列:
Rank([Date],"asc",[Product]) as [ProductRowNumber]
- 插入计算列:
If([Quantity]>Min([Quantity]) over (Intersect([Product],Previous([ProductRowNumber]))),"TRUE","FALSE")
忽略产品(整个数据集)
插入计算列:
Rank([Date],"asc") as [RowNumber]
插入计算列:
If([Quantity]>Min([Quantity]) over (Previous([RowNumber])),"TRUE","FALSE")
结果
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+
| Date | Product | Quantity | ProductRowNumber | IncreasingProduct | RowNumber | IncreasingEntireDataSet |
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+
| 11/01/2016 | a | 0 | 1 | | 1 | |
| 11/02/2016 | a | 1 | 2 | TRUE | 2 | TRUE |
| 11/03/2016 | a | 2 | 3 | TRUE | 3 | TRUE |
| 11/04/2016 | a | 3 | 4 | TRUE | 4 | TRUE |
| 11/05/2016 | a | 4 | 5 | TRUE | 5 | TRUE |
| 11/06/2016 | a | 5 | 6 | TRUE | 6 | TRUE |
| 11/07/2016 | a | 6 | 7 | TRUE | 7 | TRUE |
| 11/08/2016 | a | 7 | 8 | TRUE | 8 | TRUE |
| 11/09/2016 | a | 8 | 9 | TRUE | 9 | TRUE |
| 11/10/2016 | a | 9 | 10 | TRUE | 10 | TRUE |
| 11/11/2016 | a | 10 | 11 | TRUE | 11 | TRUE |
| 11/12/2016 | b | 0 | 1 | | 12 | FALSE |
| 11/13/2016 | b | 1 | 2 | TRUE | 13 | TRUE |
| 11/14/2016 | b | 2 | 3 | TRUE | 14 | TRUE |
| 11/15/2016 | b | 3 | 4 | TRUE | 15 | TRUE |
| 11/16/2016 | b | 4 | 5 | TRUE | 16 | TRUE |
| 11/17/2016 | b | 5 | 6 | TRUE | 17 | TRUE |
| 11/18/2016 | b | 4 | 7 | FALSE | 18 | FALSE |
| 11/19/2016 | b | 3 | 8 | FALSE | 19 | FALSE |
| 11/20/2016 | b | 2 | 9 | FALSE | 20 | FALSE |
| 11/21/2016 | b | 3 | 10 | TRUE | 21 | TRUE |
| 11/22/2016 | c | 0 | 1 | | 22 | FALSE |
| 11/23/2016 | c | 1 | 2 | TRUE | 23 | TRUE |
| 11/24/2016 | c | 2 | 3 | TRUE | 24 | TRUE |
| 11/25/2016 | c | 3 | 4 | TRUE | 25 | TRUE |
| 11/26/2016 | c | 2 | 5 | FALSE | 26 | FALSE |
| 11/27/2016 | c | 1 | 6 | FALSE | 27 | FALSE |
| 11/28/2016 | c | 2 | 7 | TRUE | 28 | TRUE |
| 11/29/2016 | c | 2 | 8 | FALSE | 29 | FALSE |
+------------+---------+----------+------------------+-------------------+-----------+-------------------------+