Formula result won't display when the agregate changes


I have a situation with a formula that looks pretty simple to me but still doesn’t work.

We have customers that bought products.
These products belong to 3 different groups A, B and D

We want to know the amount paid by customers who bought 2 or more groups of products.

My work is described in the picture below
The formula 4 that feeds the last table, is similar to the formula 3. I just replaced the “number of customer codes” with the “sum of amounts”.
But BO doesn’t seem to like it and the result of the formula is not displayed… and I don’t understand why.
The number in the table 6 should be 21300,4. It is the sum displayed in the table 4 that shows the total Amount for the customers who bought 2 or more groups of products

There’s obviously something that I’m missing so if anybody can help, I would really appreciate it

Thank you

in formula 4 there is no counting of Nb groups,
without this logic every line will be “1“ and non >= 2

sum the result of your formula 2

Hey there
Thanks a lot for your help

In fact, the variable [Nb Group] includes a count (cf. formula 1)
So the formula 4 is in fact :
=Sum([Amount] Where ((Count([Group];Distinct)) ForEach ([Cust code]) >=2))
→ I don’t understand why the formula 3 works and not formula 4.

As for the formula 2, if I sum it in a separate cell, it returns 40,468.42
→ There’s probably a problem with the context of calculation.

I have tried a different approach with the following result :

BO issue contexts and agregate 2

How come a sum can generate a Multivalue error ?