Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results 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:

 RecordKey OrderNum LineNum VAT 1 123 0 X1 1 123 1 X1 2 124 0 X0 2 124 1 X1 2 124 2 X2 3 125 0 X01 3 125 1 X1

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

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

talk is cheap, supply exceeds demand
6 Replies

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

 RecordKey OrderNum LineNum VAT 1 123 0 X1 2 124 0 X0 3 125 0 X01

But I would like to show all lines per OrderNum:

 RecordKey OrderNum LineNum VAT 1 123 0 X1 1 123 1 X1 2 124 0 X0 2 124 1 X1 2 124 2 X2 3 125 0 X01 3 125 1 X1
Partner - Champion III

Try This Expression:

rank(TOTAL -OrderNum,  1,1)

Hope it helps

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