PDA

View Full Version : How to pass Parameter in MDX Query based on user selection



AnnapurnaSankar
09-26-2008, 03:20 AM
Hi,
I had problem with passing parameter in MDX Query. I have found ParamRef() and Parameter() functions. But I didn't get so much of information wat i need.
The following is my query

with member [Store.Store].[AggregateValues] as 'Sum(Filter({[Store.Store].[All Store].[1].Children}, ([Store].CurrentMember IN {[Store.Store].[All Store].[1].[Haarlem], [Store.Store].[All Store].[1].[Leiden], [Store.Store].[All Store].[1].[Breda], [Store.Store].[All Store].[1].[Venlo]})))'
member [Measures].[1st Pairs] as '((Sum({[Year.Year].[All Year].[2008].[6]}, Sum(Crossjoin({[PairIndicator.PairIndicator].[All pairindicator].[First Pair]}, {[Measures].[Frame Qty]}))) * 100.0) / Sum({[BrandName.BrandName].[All brandname].Children}, Sum({[Year.Year].[All Year].[2008].[6]}, Sum(Crossjoin({[PairIndicator.PairIndicator].[All pairindicator].[First Pair]}, {[Measures].[Frame Qty]})))))'
select NON EMPTY {[Measures].[1st Pairs]} ON COLUMNS,
NON EMPTY TopCount({[BrandName.BrandName].[All brandname].Children}, 5.0, [Measures].[1st Pairs]) ON ROWS
from [SpecsaverSales]
where ([PairIndicator.PairIndicator].[All pairindicator].[First Pair], [Store.Store].[AggregateValues])

There I'm displaying Top 5 BrandNames. But the query should go according to the user selection. For suppose if the user selects 10 then it should display Top 10 BrandNames. So how can i pass the parameter .
Any suggestions are welcome

Thanks
Annapurna

pmalves
09-26-2008, 05:34 AM
Just use {PARAMETER} and pass it on the input