KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ How to use scan to obtain cumulative value of a function Reply To: How to use scan to obtain cumulative value of a function

  • jlucid

    Member
    October 23, 2024 at 4:03 pm

    To create the filtered_levels column from the “tab” table I used
    update filtered_levels:{x where not x within (y;z)}'[prev levels;low;high] from `tab
    which reproduces your screenshot.

    Then I wasnt sure what you meant by cumulative? Did you mean that you wanted to carry forward

    the unique filtered_levels values for each day, like a forward fills (except applied to a list)?

    You could use scan to do this using the below

    update cumulative:{distinct x,y} scan filtered_levels from tab