• I see no reason to do this in SSIS.

    SSIS will not "remember" the values you stored in the variables. It only maintains the values of variables during runtime. You'd still have to persist the values in a table.

    I would implement your logic in TSQL, probably will be a lot easier.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP