We can filter data in MDX by using Slicer Axis or Using Filter Function.
Filtering data using Slicer Axis (Where Clause)
Query 1: Query to get "Reseller Order Count" for "United Kingdom".
SELECT
[Measures].[Reseller Order Count] ON COLUMNS
FROM [Adventure Works]
WHERE [Geography].[Geography].[Country].&[United Kingdom]
Filtering Data using Filter Function
Syntax: FILTER( «Set», «Search Condition» )
Query 2: Query to get "Reseller Order Count" for all countries where "Reseller Order Count" > 100
SELECT
FILTER
(
(
[Geography].[Geography].[Country]
,[Measures].[Reseller Order Count]
)
, [Measures].[Reseller Order Count] > 100
)ON COLUMNS
FROM [Adventure Works];
Filtering data using Slicer Axis (Where Clause)
Query 1: Query to get "Reseller Order Count" for "United Kingdom".
SELECT
[Measures].[Reseller Order Count] ON COLUMNS
FROM [Adventure Works]
WHERE [Geography].[Geography].[Country].&[United Kingdom]
Filtering Data using Filter Function
Syntax: FILTER( «Set», «Search Condition» )
- Filter function is very useful in situation where we have already used a Hierarcy on some axes.
Query 2: Query to get "Reseller Order Count" for all countries where "Reseller Order Count" > 100
SELECT
FILTER
(
(
[Geography].[Geography].[Country]
,[Measures].[Reseller Order Count]
)
, [Measures].[Reseller Order Count] > 100
)ON COLUMNS
FROM [Adventure Works];
No comments:
Post a Comment