Comparing members in MDX (By Mosha Pasumansky)
Often I run across MDX expressions which require to apply different formulas based on whether or not current member is some hierarchy is equal to some particular member. For example, we may need to check whether current time member is the very first month, or whether current account is Flow. While the best way to approach those problems is try to split calculation into several calculations, each one with its own scope, it is not always possible, and the checks for member equivalence are done as part of the MDX expression itself, usually inside condition of IIF function. So let's see what is the best way to perform such comparisons both from correctness and performance point of view. I will use the example of check for current account being Flow. So we need to compare two members: On one hand we have MDX expression for the current account - [Account].CurrentMember, and on another hand we have unique name of the Flow account - [Account].&[Flow]. It is not uncommon to see people trying to write something like following:
Tags: mdx