Udostępnij za pośrednictwem


Filtr (MDX)

Zwraca zestaw, powstały na skutek filtrowania określonych na podstawie warunek wyszukiwania.

Filter(Set_Expression, Logical_Expression )

Argumenty

  • Set_Expression
    Prawidłowe wyrażenie Multidimensional Expressions (MDX), która zwraca zestaw.

  • Logical_Expression
    Prawidłowe wyrażenie logiczne Multidimensional Expressions (MDX), którego wynikiem jest wartość true lub false.

Remarks

The Filter funkcja evaluates the specified logical wyrażenie against each spójna kolekcja in the specified zestaw. Funkcja zwraca zestaw, który składa się z każdym spójnej kolekcji w określonym zestawie, gdy wyrażenie logiczne ma true. Jeśli nie krotek mają true, zwracana jest pustego zestaw.

The Filter funkcja works in a fashion similar to that of the IIf funkcja.The IIf funkcja returns only one of two options based on the evaluation of an MDX logical wyrażenie, while the Filter funkcja returns a zestaw of tuples that meet the specified warunek wyszukiwania. W efekcie Filter Funkcja wykonuje IIf(Logical_Expression, Set_Expression.Current, NULL) na każdej spójna kolekcja z zestaw i zwraca wynikowy ustawić.

Przykłady

W poniższym przykładzie pokazano użycie funkcja Filtr na oś wierszy kwerendy, aby zwrócić tylko daty, gdzie Internet Sales Amount jest większa niż 10 000 zł:

SELECT [Measures].[Internet Sales Amount] ON 0,

FILTER(

[Date].[Date].[Date].MEMBERS

, [Measures].[Internet Sales Amount]>10000)

ON 1

FROM

[Adventure Works]

Funkcja Filter można także używać wewnątrz definicji obliczany element członkowski.W poniższym przykładzie zwraca sumę Measures.[Order Quantity] składnik zagregowane w pierwszych dziewięciu miesiącach w 2003 Date wymiar, z Adventure Works moduł.The PeriodsToDate funkcja defines the tuples in the zestaw over which the Aggregate funkcja operates. The Filter funkcja limits those tuples being returned to those with lower values for the Reseller Sales Amount miara for the previous czas period.

WITH MEMBER Measures.[Declining Reseller Sales] AS Count
   (Filter
      (Existing
         (Reseller.Reseller.Reseller), 
            [Measures].[Reseller Sales Amount] < 
               ([Measures].[Reseller Sales Amount],[Date].Calendar.PrevMember)
        )
    )
MEMBER [Geography].[State-Province].x AS Aggregate 
( {[Geography].[State-Province].&[WA]&[US], 
   [Geography].[State-Province].&[OR]&[US] } 
)
SELECT NON EMPTY HIERARCHIZE 
   (AddCalculatedMembers 
      ({DrillDownLevel
         ({[Product].[All Products]})}
        )
    ) DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS 
FROM [Adventure Works]
WHERE ([Geography].[State-Province].x, 
   [Date].[Calendar].[Calendar Quarter].&[2003]&[4],
   [Measures].[Declining Reseller Sales])