Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Add column with ascending numbers

I have a pivot table that shows totals in the order that I want to show them.

I'd like to add a column at the beginning that simply enumerates the rows that are already there (so 1,2,3,4,...) just to help people see the ranking of each row (similar to the row numbers on the left in Excel).

Is there an easy way just to add these numbers? I'd use the rank feature but my columns are already complicated dimensions using multiple ranking calculations.

1 Solution

Accepted Solutions
Not applicable

Re: Add column with ascending numbers

FYI, I figured this out.  I used the aggr and rank functions to do this. This ranks a customer by their current vs prior gap.

Here is my code (simplified):

=aggr( rank(total

aggr( Sum (YTDSales) - Sum (PrevYrSales),PayerName) ,0,1) ,PayerName)

4 Replies
boorgura
Valued Contributor

Add column with ascending numbers

Use the rowno() function.

Not applicable

Add column with ascending numbers

The RowNo function might mess up your ranking functions in the expressions. If so, I would simply use a Count distinct of a unique value that defines each row, such as an ID:

Count(Distinct ID)

Thanks,

Aline

Not applicable

Add column with ascending numbers

Neither of those suggestions are working for me.

Rocky, in the help docs it only describes rowNo in the context of input files. Could you give an example of how this might work in a chart as a calculated dimension?

Not applicable

Re: Add column with ascending numbers

FYI, I figured this out.  I used the aggr and rank functions to do this. This ranks a customer by their current vs prior gap.

Here is my code (simplified):

=aggr( rank(total

aggr( Sum (YTDSales) - Sum (PrevYrSales),PayerName) ,0,1) ,PayerName)

Community Browser