Attached document helps in displaying the Top n values by dimension. In calculated dimension I am limiting to display Top 3 values for each value in first dimension. If you want to increase the Top n values to be displayed just replace N in the below expression.
=aggr(if(rank(FAILURE) < (N + 1), TEST),LOCATION,TEST)
Hope this helps others.