How to dynamically calculate TopN

Finally I am sitting down to post an interesting thing I came across during my recent release. I would like to than Gopal Kethineni for this.
The requirement was very interesting and important :
Business wanted to calculate Top 10 opportunities/$ amounts by different slices/dices.
In past we had accomplished the above requirement by pre calculating the values. But the permutations and combinations were many. E.g Top 10 Opportunities By Geographical Hierarchy or By Product Hierarchy or by Time Hierarchy. If we had to pre calculate all of the above permutations and combinations than we had to write too many ETL and eventual ETL load would have delayed.
To make solution more scalable and dynamic we used POWER of OBIEE by twisting giving TOPN function. Following is the example .
For Every Level 4 Of Geographical Hierarchy, show all the Top 10 Customers based on the opportunity amount. Along with this we need to show all the Level 5 of the Geographical Hierarchy.
In the above example the challenge was to select Level 4,Level 5 , Customer Name, and Opportunity amount as part of the criteria but to calculate Top 10 customer only Level 4 Of Geographical Hierarchy needed to be considered as Level 5 was needed to be considered as only an attribute. To solve the above complex problem.Following expression was used as part of formula column.
1TOPN(SUM("Fact - Customer"."Opportunity Amount" by "Dim - Geo Hrchy"."Level 4", "Dim - Customer"."Customer Name"),10 by "Dim - Geo Hrchy"."Level 4")
We have saved more than several hours of ETL development/QA and system resources time. If I can count correctly, I would say we must have saved more than $100K , by implementing this solution.