Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

/ (Divide) (MDX)

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Performs an arithmetic operation that divides one number by another number.

Dividend / Divisor


A valid Multidimensional Expressions (MDX) expression that returns a numeric value.


A valid MDX expression that returns a numeric value.

A value with the data type of the parameter that has the higher precedence.

The actual value returned by the / (Divide) operator represents the quotient of the first expression divided by the second expression.

Both expressions must be of the same data type, or one expression must be able to be implicitly converted to the data type of the other expression. If Divisor evaluates to a null value, the operator raises an error. If both Divisor and Dividend evaluate to a null value, the operator returns a null value.

The following example demonstrates the use of this operator.

-- This query returns the freight cost per user,
-- for products, averaged by month. 
With Member [Measures].[Freight Per Customer] as
    [Measures].[Internet Freight Cost]
    [Measures].[Customer Count]

    [Ship Date].[Calendar].[Calendar Year] Members ON 0,
    [Product].[Category].[Category].Members ON 1
    [Adventure Works]
    ([Measures].[Freight Per Customer])

Dividing a non-zero or non-null value by zero or null will return the value Infinity, which is displayed in query results as the value "1.#INF". In most cases, you should check for division by zero to avoid this situation. The following example shows you how:

//Returns 1.#INF when Internet Sales Amount is zero or null

Member [Measures].[Reseller to Internet Ratio] AS

[Measures].[Reseller Sales Amount]


[Measures].[Internet Sales Amount]

//Traps the division by zero scenario and returns null instead of 1.#INF

Member [Measures].[Reseller to Internet Ratio With Error Handling] AS

IIF([Measures].[Internet Sales Amount]=0, NULL,

[Measures].[Reseller Sales Amount]


[Measures].[Internet Sales Amount])


{[Measures].[Reseller to Internet Ratio],[Measures].[Reseller to Internet Ratio With Error Handling]} ON 0,

[Product].[Category].[Category].Members ON 1


[Adventure Works]

WHERE([Date].[Calendar].[Calendar Year].&[2001])

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft