You probably want to use resident loads. You might also want to create a Composite key of State and Step so as to avoid a Synthetic key.
State & '-' & Step as StateStepKey,
// or you could use AutoNumberHash256(State, Step) As StateStepKey, which creates a numeric key
Sum_of_Sum / Count_of_Key as Avg_Sum_Value;
Sum(Sum) As Sum_of_Sum,
Count(StateStepKey) As Count_of_Key
Group by StateStepKey;
This uses a preceding load to do a calculation with the newly derived Sum_of_Sum - I don't know exactly what you want to do with that but I am showing an example.
I think you might have the wrong idea? Imagine this as creating a pivot table from the original table. It would need to have a total column, a state column, and a step column, and the total column would have a value that sums the values for each day, the associated data points from the State-Step composite you mentioned.
Like I said, I'm a newbie to Qlikview, so maybe this is pretty basic. I'm qualifying both tables where necesarry, so syn tables/key aren't an issue, and it would be necesarry to maintain the states and steps in individual columns. I'm going to mess around with the Group by, but I still think this would have to be in a For Each construct, but I don't know how to reference a table in the IN portion of this syntax.
I could create an array of states but... this proprietary language is is limited and confusing.