Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Number rows in a table

Hi all,

I've been looking but cannot find it.

I have a table with a number of rows. Now I want to add a column in wich, from top to bottum, the ruwn are numbered (1 to ...). This is usefull when making for example a table to rank customers (based on turnover for example). Where is this option hidden?

(I did this before with an expression COUNT DISTINCT and then accumulation of this value ( a customer is unique), but with more than 1 dimension, this doesn't work).

Thx in advance,

Yves.

6 Replies
Not applicable
Author

Above may work (where Counter is the name of this expression):

If(Above(TOTAL Counter), Above(TOTAL Counter) + 1, 1)


Not applicable
Author

it's easy with a pivot; add sum(1) as an expression and set full accumulation.

johnw
Champion III
Champion III

Even easier: 1 as the expression, full accumulation.

Edit: Never mind, somehow I glazed over the part where you had multiple dimensions. The default accumulation is only in the context of the current segment. So I'd do this, which is sort of a simplified version of NMiller's expression:

rangesum(1,above(total Counter))

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

=rowno(TOTAL)

-Rob

Not applicable
Author

This works, but then I cannot chose on wich column I sort my table. I need it sorted on an other value (descending)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


Organi wrote:Now I want to add a column in wich, from top to bottum, the ruwn are numbered (1 to ...)



Organi wrote:
This works, but then I cannot chose on wich column I sort my table. I need it sorted on an other value (descending)<div></div>


I'm confused as to exactly what you are trying to accomplish. Can you post an example?

If you want to rank by other than the sorting column, then try
=rank(TOTAL expression)

but I suspect this is not what you are asking for.

-Rob