MDX: Member and Set Functions Purchase the entire course

18 December 2013 · · 5137 views

Thinking in sets

Being able to think in sets is the key to being able to write more advanced queries and calculations in MDX. It’s not possible to write procedural code in MDX; instead you have to use functions that return sets and members to express what you want to appear on rows or columns in a query, and to express more complex transformations inside your calculations.

Chris Webb introduces the commonest MDX functions that return sets in this 40-minute, demo-driven video, starting with the .MEMBERS function and the CROSSJOIN() function.

When used with a hierarchy, the .MEMBERS() function returns a set consisting of all the members on that hierarchy; when used with a level on a hierarchy it returns a set containing all of the members on that level. The CROSSJOIN() function takes two or more sets, and it returns a set of tuples containing all of the possible permutations of the members in each set.

Another very useful family of functions are those that allow you to move up, down, forwards and backwards in a hierarchy, and which return a set, or a member relative to another member: the hierarchical functions. To move up or down the hierarchy, you can use the .PARENT function, which returns the member immediately above a member in the hierarchy, or the .CHILDREN function, which returns the set of members underneath a member. You can also use the DESCENDANTS() function to return the complete set of members underneath a member at every level of the hierarchy or at a particular level and the ANCESTOR() function to return the ancestor of a member above it in a hierarchy at a given level. To move one member forwards, or backwards along a level from a given member, you can use the .NEXTMEMBER and .PREVMEMBER functions, while to move forwards or backwards more than one member you can use the .LEAD() and .LAG() functions. Finally, to find the set of members between two members on the same level of a hierarchy you can use the range operator, a colon (:).

Make sure to watch, and to follow Chris’s examples from this video, as these are some of the most useful, and fundamental MDX functions you will need in your work.

Log in or purchase access to play the video.

  • MDX Basic Concepts 29-min Watch with Free Subscription

  • MDX Queries 24-min Watch with Free Subscription

  • MDX Calculated Members 52-min

  • MDX: Member and Set Functions 38-min

  • What is the MDX Current Member Function? 5-min Free—Watch Now

  • MDX Numeric Functions and CURRENTMEMBER 33-min

  • MDX: Previous Period Growths, Shares & Moving Averages 38-min

  • More MDX Member & Set Functions 1-hour 37-min

  • What is a Subselect in MDX? 3-min Watch with Free Subscription

  • Exists, MDX Solve Order, and Subselects 49-min

  • MDX Performance Diagnosis with Profiler 29-min

Purchase a Full Access Subscription

Individual Subscription


Access all content on this site for 1 year.
Group Purchase

from $480/year

For small business & enterprise.
Group Purchase
  • You can also redeem a prepaid code.
  • Payments are instant and you will receive a tax invoice straight away.
  • We offer sales quotes/pro-forma invoices, and we accept purchase orders and bank transfers.
  • Your satisfaction is paramount: we offer a no-quibble refund guarantee.
  • See pricing FAQ for more detail.
In collaboration with
Project Botticelli logo Oxford Computer Training logo SQLBI logo Prodata logo