My apologies @Philippfk , I misread your post. Ok, i would probably pivot the data as follows:
[Edit - ticked “retain row order” on advanced settings! ]
This will then give you a table in the following form, from which you can then use Math Formula to perform your calculations



