0

所以我有这个问题,我们想在每个班次中找出哪台机器最后开始工作。即哪台机器是最后注册负载的。所以这

max(aggr(min({<ACTIVITY={'Loading'}>}[RECORD START TIME]),
       [CYCLE RECORD SHIFT],[CYCLE PRIMARY MACHINE])) 

给了我正确的时间,但现在我也希望能够返回机器名称。

这是一个数据样本

load * inline [
ACTIVITY,CYCLE PRIMARY MACHINE,CYCLE RECORD SHIFT,CYCLE SHIFT START TIME,RECORD START TIME
Loading,DT90015,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 11:45:17
Loading,DT90015,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 12:02:14
Loading,DT90015,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 12:21:32
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 08:12:48
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 08:50:43
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 09:17:27
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 09:53:19
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 11:51:52
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 12:07:09
Loading,DT90023,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 12:29:23
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 08:08:54
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 08:24:51
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 08:40:15
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 09:02:07
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 09:25:59
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 09:57:36
Loading,DT90024,2016/02/25.0,25/02/2016 07:00:00,25/02/2016 12:37:09
];

感谢 Eldad 的建议,但返回的是:

每班绩效

我可能应该在我的原始问题中包含我想要创建的表

4

2 回答 2

1

创建一个新变量“vMax”并赋值

=Timestamp(max(aggr(min({<ACTIVITY={'Loading'}>}[RECORD START TIME]),
   [CYCLE RECORD SHIFT],[CYCLE PRIMARY MACHINE])) )

然后使用此计算来获取机器名称:

=MaxString({<[RECORD START TIME]={'$(vMax)'}>}[CYCLE PRIMARY MACHINE])
于 2016-04-20T14:02:58.383 回答
1

抱歉耽搁了,所以是一个可行的解决方案,基本上在您的脚本中,您需要创建另一个汇总表,例如

LastMachine:
Load [CYCLE RECORD SHIFT], max([RECORD START TIME]) as max_ts Resident Data group by [CYCLE RECORD SHIFT];
left join
Load [CYCLE RECORD SHIFT],[RECORD START TIME] as max_ts, [CYCLE PRIMARY MACHINE] as Last_Machine Resident Data;

然后你得到

在此处输入图像描述

于 2016-06-29T16:41:40.300 回答