Spotfire - 两个表上的自定义表达式
Spotfire - Custom expression on two tables
我有两个 table,一个包含一些车辆及其高度,另一个包含每种车辆的限制。
我想在条形图中显示每个类别中超出高度限制的车辆数量。为此,我需要一个自定义表达式。
我尝试了一些方法但它不起作用,因为有两个 table,当只有一个 table 时效果很好。由于技术原因,我不能只有一个 table。这是我的尝试:
sum(If([VEHICLE].[height]>[HEIGHT_LIMIT].[hlimit],1,0) OVER (Intersect([VEHICLE].[category]))
有了这个我得到以下错误:
All arguments of the function '>' in the expression must be aggregating when the visualization combines data from different tables.
这是一个小数据样本:
VEHICLE TABLE
category | id | height
---------+----+------
A | 1 | 1
A | 2 | 3
A | 3 | 3
A | 4 | 4
B | 1 | 2
B | 2 | 4
C | 1 | 1
C | 2 | 1
HEIGHT_LIMIT TABLE
category | hlimit
---------+----------------
A | 2
B | 3
对于此数据示例,条形图应显示类别 A 为 3,类别 B 为 1,类别 C 为 0。
首先,我想承认我从来没有创建过一个自定义表达式来解决多个 table。
我的解决方案是使用左外连接将 hlimit 列插入车辆 table,然后创建一个计算列,如果超过 hlimit 则为 1,否则为零。两个 table 仍将保留在应用程序中。
我有两个 table,一个包含一些车辆及其高度,另一个包含每种车辆的限制。
我想在条形图中显示每个类别中超出高度限制的车辆数量。为此,我需要一个自定义表达式。
我尝试了一些方法但它不起作用,因为有两个 table,当只有一个 table 时效果很好。由于技术原因,我不能只有一个 table。这是我的尝试:
sum(If([VEHICLE].[height]>[HEIGHT_LIMIT].[hlimit],1,0) OVER (Intersect([VEHICLE].[category]))
有了这个我得到以下错误:
All arguments of the function '>' in the expression must be aggregating when the visualization combines data from different tables.
这是一个小数据样本:
VEHICLE TABLE
category | id | height
---------+----+------
A | 1 | 1
A | 2 | 3
A | 3 | 3
A | 4 | 4
B | 1 | 2
B | 2 | 4
C | 1 | 1
C | 2 | 1
HEIGHT_LIMIT TABLE
category | hlimit
---------+----------------
A | 2
B | 3
对于此数据示例,条形图应显示类别 A 为 3,类别 B 为 1,类别 C 为 0。
首先,我想承认我从来没有创建过一个自定义表达式来解决多个 table。
我的解决方案是使用左外连接将 hlimit 列插入车辆 table,然后创建一个计算列,如果超过 hlimit 则为 1,否则为零。两个 table 仍将保留在应用程序中。