cancel
Showing results for 
Search instead for 
Did you mean: 

Database Ranking 2 dimensions

elugari
Explorer
0 Kudos

I was wondering if is possible to drop 2 dimensions in the Drop a dimension here

I have a requirement to create a database ranking query using two dimensions

Any ideas are really welcome

Regards

Ercole

Accepted Solutions (0)

Answers (2)

Answers (2)

The short answer is no, you can't put more than one dimension in that box. The main ranking part of the subquery requires exactly one dimension and exactly one measure.

To calculate the measure using a combination of two dimensions, or to somehow consider more than one measure in the ranking you will need to create extra objects at the universe level as composites/concatenations of the objects you want to consider.

Example: Create a dimension called "RankingValue" and define it as something like:
DB1.Table1.Field1 || "|" || DB1.Table1.Field2

There is also a third box to drop dimensions in. This third box "Ranked by" will allow you to perform the ranking repeatedly over a changing context.

For example, if you wanted to find the top 10 sales products for the entire dataset, you might try something like:
Top 10 [Sales Product] Based on [Sales Revenue]

But, if you want the Top 10 products for each Store, you can also do that using the Ranked by:
Top 10 [Sales Product] Based on [Sales Revenue] Ranked by [Store]

One thing to always remember when using the ranking subquery is that, unlike a typical SQL TOP keyword, it will not cut the number at the exactly specified count if there is overspill with the same measure value. So, if you are looking for the top 3, and there are 5 at the top with the exact same measure value, you will get all 5, not just 3 of them.

Hope this helps.

elugari
Explorer
0 Kudos

Thanks for the confirmation. At then end I solved it concatenate the 2 dimensions

Ercole