Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
kkrause
Contributor II
Contributor II

Dense Rank

Hi,

This might be very easy but I could not figure it out. I'm looking for a function for a dense rank in QlikView.

For example:

dense_rank( expression1, ... expression_n ) WITHIN GROUP ( ORDER BY expression1, ... expression_n )

How does it work in QlikView pivot or table?

The function will be needed on pivot or table level.

The ranking can't be precalculated during load (skript) because one of the criteria will be calculated on the fly (tariff simulator).

Many thanks in advance.

4 Replies
swuehl
MVP
MVP

Kai,

start with building your pivot or straight table, choose the dimensions as needed and set an expression after which you want the table's rows ranked.

Then you need a rank function, e.g. if you have sum(Sales) as expression and SalesPerson as dimension,

your rank could look like

= rank(sum(Sales))

This should already give a ranking of SalesPerson after Sales Amount)

As I understood a dense rank is special, because it assigns equal values the same rank number, but continues ranking with the next rank order number, e.g. you may get something like:

Sales, Rank

300,    1

300,    1

200,    2

200,    2

100,    3

In QV, you set the rank mode as second parameter to rank function, but I think density rank is no standard mode in QV, so if this is really needed, we have to look for a work around.

But as a start off, try building a table and use rank function to get used to the QV charts and ranking (and have a look into rank() function in help file).

Regards,

Stefan

kkrause
Contributor II
Contributor II
Author

Thanks for the first hint.

For my solution it also helpful to rank over an partition CUSTOMER_ID (see example).

The column "value" will be calculated dynamically in a pivot table in dependency to a tariff tableau.

How must the statement looks like to generate this ranking?

Thanks.

swuehl
MVP
MVP

Kai,

please have a look at attached. Ranking will be per column segment, so if you want to rank customer's values per customer, you need a second dimension, I used Value for this, but probably something unique like OrderID etc. would be better.

And just replace Value with your expression needed to calculate the Value.

Regards,

Stefan

Not applicable

Nine one, thanks Stefan.