It may make sense to build this dimension in the script using the group by function. I think the issue you're seeing is that when you try to use Sum(Cant) in the calculated dimension, it doesn't know what group of records needs to be summed. Try something like what I did in the script of the attached doc. One thing to note, is that I'm not sure what field you're trying to sum for, so you may need to change the producto fields in the attached script. At the very least this should give you a starting point to work from.