Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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!

Labels (1)
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
Partner - Master III
Partner - Master III

Hi Fredrik,

you could try this:

10000000 - AutoNumber(..)

Max. value depending on amount of records.

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
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;