Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I've read that DAX supports the operator overloading.
Operator overloading in computer programming is the process of defining custom behaviors for operators like +, -.
So, a same operator could be overloaded to work with an integer and a string.
But how does DAX support the operator overloading? Does the operator result depend on the operator data type or the data type of the operands?
I'd like to understand better the DAX operator overloading.
Thanks
Hi @pmscorca,
I wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.
If the community member's answer your query, please mark it as "Accept as Solution" and select "Yes" if it was helpful.
If you need any further assistance, feel free to reach out.
Please continue using Microsoft community forum.
Thank you,
Pavan.
Hi @pmscorca,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept as Solution" and give a 'Kudos' so other members can easily find it.
Thank you,
Pavan.
Hi @pmscorca,
Thank you for reaching out in Microsoft Community Forum.
Thank you @lbendlin, @Ritaf1983 for the helpful response.
As suggested by Ibendlin and Ritaf1983, I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.
Please continue using Microsoft community forum.
Regards,
Pavan.
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?
Hi @pmscorca
It also depends on what’s on the other side of the operator.
For example, if you try to use the + operator between a number and a text string, you'll get an error.
But if the number is actually stored as text, and you try to concatenate it with another string, the engine treats both operands as text and performs concatenation.
So the operator behavior depends not only on the expected data type but also on the actual data types involved – and sometimes the result is determined by how the engine coerces types based on context.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
The addition (+ operator) between a number and a numeric string returns a numeric value according to the MS documentation: DAX tries to convert the numeric string in a number, because the expected operands of the additions have to be numeric; a such conversion is performed successfully because the actual numeric string can be converted in a number. For a text string as an addition operand, this implicit conversion fails.
So, a DAX operator respect to the expected operand data types affects the operator result and the operator behaviour doesn't change respect to the actual operand data types.
I think that in DAX it has no sense to talk about operator overloading: the behaviour of + operator doesn't change respect to actual text operands because it expects numeric operands.
Thanks
Here's a fun one. Calculated column, but works with measures too
For example: TODAY()+1
for date math
Or: {1}
for table math
Or: CONCATENATEX(table,[column])
for table to scalar math
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.