Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Number table row consecutively

Hi!

We would like to add a column that simply shows "1" for the first row, "2" for the 2nd row and so on.

It should always show the same numbering even when the sorting is changed.

Thanks for your help!

Best Regards

Sebastian

16 Replies
Clever_Anjos
Employee
Employee

Would you mind sharing a qvw?

I´ve done a small test, seems to sort ok. Maybe I´m not understanding your point of view

Not applicable
Author

Gysbert Wassenaar

Clever Anjos

Thank you all for the overwhelming support. I did not expect such a lively community!

Attached two files showing the problem (xls and qvw).

As you can see the table cannot be sorted by "AVG(rate_overall)".

If you remove the column "RowNo(TOTAL)" it works fine.

Putting RecNo or RowNo into the script did not seem to work either, due to the aggregate function used in the table.

My Task is to sort the table by "AVG(rate_overall)" or other columns and show one column containing the row number.

I would like to make a ranking of location ratings and the ranking should show, too.

Looking forward to your ideas!

Not applicable
Author

Hi Sebastian,

Does the attached document illustrate my understanding to your question correctly?

I guess RowNo() as UID (that  Kai Hilton-Jones

suggested) in the script shall help you.

Let us know how it goes.

Best wishes,

Not applicable
Author

Hi Kadir,

I am testing the personal edition, cannot open your file - sorry!

Attached my try to include rowNo in the script, which apparently does not work (see table).

Best Regards

Sebastian

Clever_Anjos
Employee
Employee

Checked here, you´re right.

I don´t know why is happening this way

swuehl
MVP
MVP

This does not work because you have multiple records per a given dimension value, so QV does not know what to return for UID.

But anyway, it seems that wouldn't solve your problem, because you don't want a rowno determined during script load, but determined from chart y-values (I assume also you might want to dynamically filter the table).

If you just want to sort your avg value, then show the rank, I would suggest using the rank() function in your chart expression:

=num(rank(-Avg(rate_overall),4))

for average sorted asc, and without the minus sign for desc order.

Or if you want a fixed rowno, use

=rowno(total)

as expression (chart inter records limit the options QV allow to sort, check the Help for more detail) and use a sort expression like =avg(rate_overall) for the dimension.

I hope this helps,

Stefan

Not applicable
Author

Hi!

"=num(rank(-Avg(rate_overall),4))" works fine but is limited to be tied to the rate_overall column.

So this should be considered as a workaround but not a solution.

Anyway this is the best answer so far!

Regards

Sebastian