Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Add ID-number in a pivot table

Hi all,

I've got a pivot table which looks as follows (simplified):

                                                                                                              

DimensionsExpressions
IDordernumberproductPricediscount
16a          3,00 0
b          6,23 0
c          9,46 30%
33d       12,69 0
e       15,92 0
341f       19,15 0
395g       22,38 15%
h       25,61 0
121i       28,84 0
137j       32,07 0

Now, I would like to fill the column "ID" with a row number based on the unique ordernumber. So, ordernumber 16 is assigned a 1, ordernumber 33 is assigned a 2, ordernumber 341 is assigned a 3 etc.

I've tried to use RowNo() and RowNo(total), but this function doesn't work in the dimensions and when I use RowNo(total) in an expression it assigns the rownumber to the actual row, so the line with product a=1 and product b=2.

Your help is appreciated.

4 Replies
giakoum
Partner - Master II
Partner - Master II

try to combine it with Dimensionality() as an expression

JonnyPoole
Employee
Employee

Here is a sample. My 1st dimension is 'calculated' with a formula like this: 

=aggr(RowNo(),Year)

Capture.PNG

Anonymous
Not applicable
Author

Thanx, this works!!

Now rises a second question. Maybe you know an answer on the spot.

Suppose order 121 also contains product C. When I select product C, I would like to see the ID-number assigned by your formula. However, if I select it now, the ID-number of order 121 obviously changes to 2.

So is it maybe possible to copy this table and refer from this second table to the column ID in table 1?

JonnyPoole
Employee
Employee

I sense this is probably doable but need to give it a bit more thought. stay tuned.