That's probably because your calendar (Calendario_DEAL_EXTERNALS.Anomes) shows all that additional values, and your expression just tells to sum all preceding months. But an additional condition could help (assuming that you get a count>0 in all passed months: