I thought that this would work but is wrong. First of all, I have this fields:
NumPeriodo: Period`s number, being 01 for August and 11 for July.
PERIODO: Is compossed by Year+NumPeriodo, for example August 2010 would be 201001
%KeyPeriodo: This is an ID to identify the periods so 1 identify the periods of 2010(August2010 to July2011), 2 = (Aug2011 - July2012) , etc.
When the user selects a PERIODO, for example 201107 (Year 2011, NumPeriodo 07) I need to add all the values of Promedio since NumPeriodo=01 to NumPeriodo = 07. The %KeyPeriodo would be 2 for all that periods.