# Database Discussions > Microsoft SQL Server 2005 >  Dynamic MDX Query

## dineshspatel

Hi,

I want to build Dynamic MDX query in SQL Server 2005. Is it possible? 

ex. I have one SQL Server Report parameter which contain following value:
1. Station
2. Free Test

I have three Dimension Station, Free Test, Overall Result and one measure Total Test.

If I select Station in report parameter then following report format i need:

Station   | Pass  | Fail | Total Test
x1             60      40     100
x2             ...     ...     ...

If I select Free Test in parameter then following report format i need:
Free Test   | Pass  | Fail | Total Test
yes                60      40     100
no              ...     ...     ...

I tryed using following query but not sucessful:

WITH SET [Groupby] AS STRTOSet(@Query1)
SELECT NON EMPTY ([Measures].[Total Test Count]) ON 0, 
NON EMPTY [Groupby] * [Dim OverallResult].[Overall Result].[Overall Result].AllMembers  ON 1
FROM [OLAP Test Cube]

let me know if you have any solution?

Dinesh Patel

----------

