# Database Discussions > MDX and Analysis Services >  MDX query help

## MDX

Hi All,

I am having issues in writing an MDX query for the below scenario.As I am new to MDX it is getting diffcult to work on the below scenario. 


I have some measures created as

Attainment = Num/DEN  (%)

Number of Student = Count of student.

A Teacher would have some student under him.


So for e.g. I would have teacher X having '11' students under him.


I wonder how to write an MDX query that could bucket the number of students based on Attainment 

so for instance, I could see the 

Teacher (X)

        3 with Attainment of 100%, 

        5 with Attainment between 95-99, 

        2 with Attainment between 90-94,

        and 1 with Attainement < 90





Thanks


--------------------------------------------------------------------------------

----------

