SCD_AT_TIME

All functions > BUSINESS > SCD_AT_TIME

Returns the state of an SCD (slowly changing dimension) value at the given point in time.

Signatures

Returns: Value as it was at the specified point in time

SCD_AT_TIME(scd: ARRAY<ROW(time_update: TIMESTAMP, value: T)>, point_in_time: TIMESTAMP) → T
sql
ParameterTypeRequiredDescription
scdARRAY<ROW(time_update: TIMESTAMP, value: T)>YesArray of SCD records with time_update and value fields
point_in_timeTIMESTAMPYesTimestamp to query the SCD state at

Notes

  • SCD (Slowly Changing Dimension) tracks values that change over time
  • Each record has a time_update timestamp and a value
  • Returns the most recent value where time_update <= point_in_time
  • If no records exist before point_in_time, returns NULL
  • Useful for historical analysis and time travel queries
  • Commonly used for tracking customer attributes, prices, or configurations over time
Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19