MDX Siblings Function

The MDX Siblings function will return all the Child members that belong to the parent of a specified member. Or We can say, MDX Siblings function will return all the Siblings of a specified member. For example, If you know a single customer name and if you want to find the Sales of all the customers present in that group, then you can use this Siblings function.

MDX Siblings Function Syntax

The basic syntax of the Siblings function in Multidimensional Expression is as shown below:

Member_Expression.SIBLINGS

Member_Expression: Any Multidimensional Expression that returns valid Member.

How to write Siblings function in MDX query with examples?. For this, We are going to use the below show data. The following screenshot shows the Countries inside the Geography

MDX SIBLINGS FUNCTION

The following screenshot shows the [State – Provinces] inside the France Country

MDX SIBLINGS FUNCTION

MDX Siblings Function Example

In this example, we are going to use Siblings function to find the siblings of a France Country.

SELECT 
  [Measures].[Reseller Sales Amount] ON COLUMNS,
  [Geography].[Geography].[Country].[France].SIBLINGS ON ROWS
FROM [Adventure Works];
MDX SIBLINGS FUNCTION 1

In the above MDX Query, We used [Reseller Sales amount] on the columns

[Measures].[Reseller Sales Amount] ON COLUMNS

Below line of code will check for the France parent (Which is All member) and then displays all the child member of the Country.

[Geography].[Geography].[Country].[France].SIBLINGS

MDX Siblings Function Example 2

If we know the Loiret is one of the states in France and we intend to find the remaining states present in France then, we can use this MDX Siblings function. In this example, we are going to find all the Child Members present in the State Province list and calculate the Reseller Sales Amount of that.

SELECT 
 [Measures].[Reseller Sales Amount] ON COLUMNS,
 [Geography].[Geography].[State-Province].[Loiret].SIBLINGS ON ROWS
FROM [Adventure Works];
MDX SIBLINGS FUNCTION 2

Siblings Function Alternative

In this example, we are going to use the MDX Siblings function alternative to achieve the same result. Please refer to MDX Parent Function to understand the Parent function and see MDX Children function to understand the Children function.

SELECT 
 [Measures].[Reseller Sales Amount] ON COLUMNS,
 [Geography].[Geography].[State-Province].[Loiret].PARENT.CHILDREN ON ROWS
FROM [Adventure Works];
MDX SIBLINGS FUNCTION 3

In the above MDX Query, We used [Reseller Sales amount] on the columns

[Measures].[Reseller Sales Amount] ON COLUMNS

From Below line of code,

[Geography].[Geography].[State-Province].[Loiret].PARENT.CHILDREN

The multidimensional expression will first implement the Parent function to find the parent member of a [Loiret], Which is France.

Next, It will implement Children function to find all the Child member belongs to the France Country.