Forum Discussion
Understanding DAX operator overloading
Hi pmscorca
DAX doesn't support operator overloading in the traditional object-oriented sense, but it does define different behaviors for the same operator based on the operand types.
For example, + / - works for numberical data types and also for adding days to a date.
However, DAX doesn't use + for strings – it uses & for string concatenation.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Ok, but does the operator result depend on the operator data type (or better the expected data type of the operands) or the real data type of the operands?
The + operator expects numeric operands; if numeric strings are used, this operator continues to return a numeric result.
The & operator expects alphanumeric operands; if numeric strings are used, this operator raises an error.
It seems that it drives the expected operand data type without overriding the operator behaviour, isn't it?