Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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)

View solution in original post

4 Replies
boorgura
Specialist
Specialist

Use the rowno() function.

Not applicable
Author

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
Author

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
Author

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)