【问题标题】:Find last value in a time series over multiple items in Spotfire在 Spotfire 中查找多个项目的时间序列中的最后一个值
【发布时间】:2018-01-29 14:31:27
【问题描述】:

我试图在一个数据表中查找时间序列的最后一个条目,并将该值放在另一个数据表中。

我有:

Entity  Value  Date
1       1      01/1990
1       2      02/1990
2       1      02/1990
2       3      03/1990

该函数将为实体 1 拉出 2,为实体 2 拉出 3。

我尝试过使用最后一个函数,但没有成功。

Last([Gas]) Over (Intersect([Entity], AllPrevious([C.Month/Year])))

我对 Spotfire 有点陌生,如果能提供任何帮助,我将不胜感激。

【问题讨论】:

    标签: time-series spotfire


    【解决方案1】:

    如果值是连续的,因此随着日期的增加而变大,请改用Max()

    Max([Gas]) Over (Intersect([Entity], AllPrevious([Date])))
    

    否则,您可能必须找到最后日期,并关联该值。我假设 [Date] 字段是 Date 数据类型,但如果不是,它应该是。

    case when [Date] = max([Date]) over (Intersect([Entity],AllPrevious([Date]))) then [Date] end
    

    【讨论】:

    • 谢谢@scsimon,我似乎无法让您发布的代码条正常工作?我相信 ALLPrevious 有问题,但不熟悉我在调试时遇到了麻烦。你能帮帮我吗?
    • 我在第二个公式中有错误。已更正@geop
    • 情况当 ([C.Month/Year] = max([C.Month/Year]) over (Intersect([Entity],AllPrevious([C.Month/Year]))))然后 [C.Month/Year] 结束
    • 好吗?我不知道您的列名是什么,但您在示例数据中将其列为 [Date]
    • 以上运行但给我 C.Month/Year 作为输出?
    猜你喜欢
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2020-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-20
    相关资源
    最近更新 更多