Just for info everything is right when it is not a function
No, not at all! 😉
You confuse numerical and symbolic evaluation.
Everythings is OK if you use numeric evaluation - even in your posted sheet with the function.
Its the symbolic evaluation which causes the error and this error also occurs if you don't turn it into a function.
As the very same error also occurs in Prime 6 with the old (muPad) and the new (FriCAS) symbolic processor and probably also in Luc's MC11 with Maple, it looks like the problem is not the symbolic processor itself but the interface between Mathcad and the symbolic which obviously will only accept scalar values for enumeration types.