I need help with building an MDX query to fetch data.....



i am trying to get the last date an employee has changed



i have 2 dimensions and 1 fact table (star schema)



fact table: fact_employee

dimension: date & employee_info



In fact table, i store a boolean field HasChanged?

1 - changed

0 - not changed



fact tbl looks like this

fact_id date_id user_id hasChanged

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

1 1 xxx 1

2 2 xxx 0

3 3 xxx 0

4 4 xxx 1



basically i want to be able to select the last time it has changed

in this case, when fact_id is between 3 and 4





i need a query that will go back in time and give me the last changed date!!!



i would need this as a calculation because i am planning to pass the user_id into it to get the date



any help would be highly appreciated



thanks,