[英]Spotfire - Downsample Time Series Data - Calculate New Column
In Tibco Spotfire, how do I downsample time series data to 30 minute intervals and take the closest value to the 00
and 30
minute timestamps?在 Tibco Spotfire 中,如何将时间序列数据下采样到 30 分钟间隔,并采用最接近00
和30
分钟时间戳的值?
ID DateTime Value
-----------------------------
ID1 2022-06-06 19:01:34Z 100
ID1 2022-06-06 19:06:31Z 200
ID1 2022-06-06 19:11:34Z 300
ID1 2022-06-06 19:16:31Z 400
ID1 2022-06-06 19:21:32Z 500
ID1 2022-06-06 19:26:33Z 600
ID1 2022-06-06 19:31:32Z 700
Desired Spotfire table所需的 Spotfire 表
ID DateTime Value
-----------------------------
ID1 2022-06-06 19:00:00Z 100
ID1 2022-06-06 19:30:00Z 700
Maybe not with a single calculated column, but this should help.也许不是单个计算列,但这应该会有所帮助。
1 - create a timestamp: [TimeStamp] as ToEpochSeconds([DateTime]) 1 - 创建时间戳:[TimeStamp] as ToEpochSeconds([DateTime])
2 - create a timestamp to the nearest half-hour: [RoundTimeStamp] as Round([TimeStamp] / 1800,0) * 1800 2 - 创建一个最接近半小时的时间戳:[RoundTimeStamp] as Round([TimeStamp] / 1800,0) * 1800
3 - turn it back into a datetime: [RoundDateTime]: FromEpochSeconds(Integer([RoundTimeStamp])) 3 - 将其转回日期时间: [RoundDateTime]: FromEpochSeconds(Integer([RoundTimeStamp]))
4 - select the value: [ValueForRoundDateTime] as ValueforMin(Abs([TimeStamp] - [RoundTimeStamp]),[Value]) over (Intersect([ID],[RoundTimeStamp])) 4 - select 值:[ValueForRoundDateTime] as ValueforMin(Abs([TimeStamp] - [RoundTimeStamp]),[Value]) over (Intersect([ID],[RoundTimeStamp]))
This gives you the columns you wanted, [RoundDateTime] and [ValueForRoundDateTime].这将为您提供所需的列,[RoundDateTime] 和 [ValueForRoundDateTime]。
To create a table with only the necessary rows, you could add another table based on the current one:要创建仅包含必要行的表,您可以在当前表的基础上添加另一个表:
select + then choose Other then Linked copy to data table in analysis. select + 然后选择其他然后链接复制到分析中的数据表。
Then go to the Data Canvas, add transformations:然后 go 到数据 Canvas,添加转换:
1 - exclude all columns but [ID], RoundDateTime] and [ValueForRoundDateTime] 1 - 排除除 [ID]、RoundDateTime] 和 [ValueForRoundDateTime] 以外的所有列
2 - filter as Rank(baserowid(),"asc",Concatenate([RoundDateTime],[ID]))=1 2 - 过滤为 Rank(baserowid(),"asc",Concatenate([RoundDateTime],[ID]))=1
(the latter from this support article: https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-42284 ) (后者来自这篇支持文章: https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-42284 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.