Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create an ascending Key Calculation

Hi Community,

I have a requirement to have a Qlikview Report with these structure:

RecordKeyOrderNumLineNumVAT
11230X1
11231X1
21240X0
21241X1
21242X2
31250X01
31251X1

Basically, the column OrderNum, LineNum and VAT are cointained in the source data and I would need to create RecordKey column through a calculation (because I want the user to select the ordernums). Recordkey is a number that starts in 1 for the first OrderNum and increases for each ordernum but not each line.

I have tried to accomplish that by using the rank function in this way but with no good result:

=rank(ONLY(OrderNum),4,1)

Can anybody help me with this please?

Thanks

Julian

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If you use it as an expression you need to add the nodistinct keyword: aggr(nodistinct rowno(),OrderNum)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Try aggr(rowno(),OrderNum)


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

With your formula it only shows one LineNum per OrderNum, i.e. something like this

RecordKeyOrderNumLineNumVAT
11230X1
21240X0
31250X01

But I would like to show all lines per OrderNum:

RecordKeyOrderNumLineNumVAT
11230X1
11231X1
21240X0
21241X1
21242X2
31250X01
31251X1
alexandros17
Partner - Champion III
Partner - Champion III

Try This Expression:

rank(TOTAL -OrderNum,  1,1)

Hope it helps

Gysbert_Wassenaar

If you use it as an expression you need to add the nodistinct keyword: aggr(nodistinct rowno(),OrderNum)


talk is cheap, supply exceeds demand
Not applicable
Author

Yes I was about to reply that. This works

Thanks

Julian

Not applicable
Author

try with autonumber function

AutoNumber(OrderNum)