16 Replies Latest reply: Dec 10, 2013 7:09 AM by konstantins kozins

# Row numbering by two dimension

Hello all,

I have a problem when I put RowNo to the straight table, ordering by field changed. Idea to get in result the following:

#
A
B
Value
2BBDD566
3AASS345
4GGDD111

• ###### Re: Row numbering by two dimension

To me it seems pretty strange!

I added rowno() in the loadscript and then it worked, but IMO it should work in the front-end as wel...

Is moving it to the loadscript workable for you?

RowNo() as customRowNo,* Inline

[A,B,Value

AA,SS,345

BB,DD,566

AA,DD,687
GG,DD,111]
;

And of course I'm interested in the explanation why it doesn't work in the front-end.

• ###### Re: Row numbering by two dimension

Thanks Roberto,

When I added RowNo to the script, I have the following result.

customRowNoABValue
2BBDD566
1AASS345
4GGDD111

I need to keep ordering only by Value field and show row number in the first column, any idea how to implement it?

• ###### Re: Row numbering by two dimension

kostak wrote:

I need to keep ordering only by Value field and show row number in the first column, any idea how to implement it?

I don't understand what is missing.

The result table orders by only the valuefield and shows the rownumber in the first column...

Can you explain what the expected result is?

• ###### Re: Row numbering by two dimension

Incorrect:

customRowNoABValue
2BBDD566
1AASS345
4GGDD111

CustomRowNo field should always shows values as 1,2,3,4 (just row number position in the table)

Correct:

customRowNoABValue
2BBDD566
3AASS345
4GGDD111
• ###### Re: Row numbering by two dimension

Here you are.

tmp:
[A,B,Value
AA,SS,345
BB,DD,566
AA,DD,687
GG,DD,111]

;

NoConcatenate

result:

,*
Resident tmp order by Value desc;

drop table tmp;

Use correctRowNo instead of customRowNo, then it works.

Still I don't understand why it doesn't work in the frond-end.

Anyone?

• ###### Re: Row numbering by two dimension

Hi

Use following as an expression in the straight table (not dimension):

=Alt(Above(Column(1))+1, 1)

This will count the rows from 1. Change the index in Column() to the correct value for your table. This is the position of this expression in the table's expression list.

Once this is working, just drag the column to the left most position in the chart (left of the dimensions).

Hope that helps

Jonathan

• ###### Re: Row numbering by two dimension

Jonathan,
It works fine when only one dimension exist in straight table, but not working for two dimension.

Here is the result when I added Alt(Above(Column(2))+1, 1) to my test file:

A
BValueAlt(Above(Column(2))+1, 1)
BBDD5662
GGDD1113
AASS3451
• ###### Re: Row numbering by two dimension

Add a TOTAL qualifier, that should do the trick:

=Alt(Above(TOTAL Column(1))+1, 1)

Regards

Jonathan

• ###### Re: Row numbering by two dimension

Actually, you can use

=RowNo(TOTAL)

to get the same effect! Which would be preferable to the Above trick.

Regards

Jonathan

• ###### Re: Row numbering by two dimension

The result now:

A
BValueAlt(Above(Column(2))+1, 1)
AASS3451
BBDD6872
BBDD5663
GGDD1114

And it is not correct, Value field should be ordered as descend.

Correct result shoud be as

customRowNoABValue
2BBDD566
3AASS345
4GGDD111
• ###### Re: Row numbering by two dimension

Then sort the table by Value and drag the row no to the left.

Jonathan

• ###### Re: Row numbering by two dimension

Sorry, but it doesn't work.

• ###### Re: Row numbering by two dimension

You can try this:

Rank(Total Aggr(Sum(Value), A, B))

See the attached. However, if you reverse the sort of value, the count will reverse as well.

Jonathan

• ###### Re: Row numbering by two dimension

Thanks a lot Jonathan, it works perfectly!!!

• ###### Re: Row numbering by two dimension

Hi JOnathan,

Thanks for this.

Can you please let me know how can I get Rank in Reverse Order for the descending Sorted values?