Returns the set that results from filtering a specified set based on a search condition.
The search condition is applied to each tuple of the set and only the ones where logical expression evaluates to true are returned. In case no tuples match the required conditions, empty set is returned.
Filter(Set_Expression, Logical_Expression )
|MDX expression that returns set.|
|MDX logical expression that returns true or false.|
Following example would return all Members who's invoice type is cash.
[Invoice].CurrentMember.getProperty('Invoice type') MATCHES 'Cash'
You should be very careful, when iterating through all members as the set of members can get quite large. It is suggested to do so only in cases when calculations using Tuples, which are significantly faster, cannot be performed.
Filter should work as well for detailed Invoices
Descendants([Invoice].CurrentMember, [Invoice].[Invoice Item]) should be used. For example, following formula returns sum of all invoice item quantity in given context. Normally, some further filter condition would be added as the following formula is returning the same as
Item quantity measure.
Sum(Filter( Descendants([Issue].CurrentMember, [Issue].[Issue]), [Measures].[Issues created] > 0 ), [Measures].[Issues created])
[Measures].[Item quantity] > 0
), [Measures].[Item quantity])