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

Inverting AutoNumber

Hi

I want to invert the AutoNumber function. I have a list of forecast submissions where I want the latest submission date to be nr 1 and the oldest to be the highest number.

As it is now it is giving the latest submission date the highest number and the oldest nr 1. How do I write in the script to invert the numbering?

Thanks for any help!

4 Replies
datanibbler
Champion
Champion

Hi Fredrik,

do it in several steps, without the AutoNumber() function:

- Sort the table by submission_date in desc. order (to have the latest date on top)

- Create a recordno() field to number the records

=> You can still use AutoNumber() if you want, but the recordno() should do as well.

HTH

Best regards,

DataNibbler

pgrenier
Partner - Creator III
Partner - Creator III

Hello Fredrik,

The AutoNumber() fonction will create it's associated numeric values according to the order in which the different values of the expression received as a parameter are met. Simply preorder the data using a preceding load in the desired manner (latest vs oldest submission), and you shall have the desired result.

Regards,

Philippe

rbecher
MVP
MVP

Hi Fredrik,

you could try this:

10000000 - AutoNumber(..)

Max. value depending on amount of records.

- Ralf

Astrato.io Head of R&D
CELAMBARASAN
Partner - Champion
Partner - Champion

May be with the help Order By in descending

Load

     Field,

     SubmissionDate,

     Autonumber(FieldName) As FieldAutonumber

From Source

Order By SubmissionDate Desc;