Search code examples
calculated-columnsspotfire

Spotfire: Calculated Column to find if a different event in same column occurs within 1 hour


The calculated column I am trying to create is the far right column in the below table:

In words: If a B event occurs in the specified City, does a C event occur within one hour of the B event, true or false.

I've tried a few different approaches with Over functions but just not having luck. I am struggling on how to reference a different event in the same column and then calculate a datetime difference between them..

olu

Thanks!


Solution

  • You may try to take it in stages and define intermediate columns. Try this, assuming C is the max label for the events.

    You did not post data so I generated something that seemed similar.

    ([event]="B") and (Max([event]) OVER (Intersect([city],AllNext([date])))="C") and ( DateDiff("hh",[date],ValueforMax([event],[date]) OVER (Intersect([city],AllNext([date]))))<=1)