I've Attached a sample app to replicate your desired output.
Please ensure you read and understand the load script as that is where the real trick is. This needs to be performed using Crosstable when you load your data. Google to find more info about it.
As of now you can refer to what i've done within the app.
Thx for your answer.
I have a problem with this solution :
Sometimes, I need a field to calculate another.
For example, "count(distinct if(champA=1,champC))". So i need champA and champC on each line and i can't put champA in CrossTable, am i wrong ? But if i don't put champA in CrossTable, i will have champA for each type.