我正在尝试插入一个计算列,以便在T1 = CMP 1 Stops
timestamp
时T1 = CMP 1 starts'
复制timestamp T1 Calculated Expected
5/1/2017 14:00
5/1/2017 14:15
5/1/2017 14:30 CMP 1 Starts
5/1/2017 14:45 CMP 1 Stops 5/1/2017 14:30 5/1/2017 14:30
5/1/2017 15:00
5/1/2017 15:15
5/1/2017 15:30
5/1/2017 15:45
5/1/2017 16:00
5/1/2017 16:15
5/1/2017 16:30 CMP 1 Starts
5/1/2017 16:45 CMP 1 ON
5/1/2017 17:00 CMP 1 Stops 5/1/2017 16:45 5/1/2017 16:30
5/1/2017 17:15
5/1/2017 17:30
5/1/2017 17:45
5/1/2017 18:00
5/1/2017 18:15
5/1/2017 18:30
5/1/2017 18:45 CMP 1 Starts
5/1/2017 19:00 CMP 1 ON
5/1/2017 19:15 CMP 1 Stops 5/1/2017 19:00 5/1/2017 18:45
5/1/2017 19:30
5/1/2017 19:45
Expected
示例:1=CMP 1 Stops
列
注意:在T null values
时,它不一定要填充同一行,即使它T1=CMP 1 Starts
填充所有/_layouts/home.html
它对我来说也是如此
答案 0 :(得分:1)
您需要的第一个表达式是:
If((Trim([T1])="CMP 1 Stops") or (Trim([T1])="CMP 1 Starts"),Max([timestamp]) over (PreviousPeriod([timestamp]))) as [YourNewColumn]
然后,如果你想将它限制在[T1] =" CMP 1 Stops"只需添加另一个计算列:
case when [T1] = "CMP 1 Stops" then [YourNewColumn] end as [YourFinalColumn]