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: 
OmarBenSalem
Partner - Champion II
Partner - Champion II

Incremental order by id, date

Hi all @sunny_talwar 

Here's my source : 

NUM_CADRE, DATE, Ordre
1, 01/01/2020, 1
1, 02/01/2020, 2
2, 03/03/2020, 1
5, 01/01/2020, 1
5, 02/01/2020, 2
5, 03/01/2020, 3

I want to calculate the Ordre COLUMN as it is there, by NUM_CADRE and DATE ascend; hope it's clear enough?

 

1 Solution

Accepted Solutions
OmarBenSalem
Partner - Champion II
Partner - Champion II
Author

nevermind, I found it :

table0:

load NUM_CADRE, date(date#(DATE0)) as Date, Ordre as Ordre_Test
Inline [
NUM_CADRE, DATE0, Ordre
1, 01/01/2020, 1
1, 02/01/2020, 2
2, 03/03/2020, 1
5, 01/01/2020, 1
5, 02/01/2020, 2
5, 03/01/2020, 3
];
NoConcatenate
Load * ,if(Previous(NUM_CADRE)<>NUM_CADRE,1,peek(CalculatedOrder)+1) as CalculatedOrder;
load * Resident table0 Order by NUM_CADRE,Date;

Drop Table table0;

View solution in original post

1 Reply
OmarBenSalem
Partner - Champion II
Partner - Champion II
Author

nevermind, I found it :

table0:

load NUM_CADRE, date(date#(DATE0)) as Date, Ordre as Ordre_Test
Inline [
NUM_CADRE, DATE0, Ordre
1, 01/01/2020, 1
1, 02/01/2020, 2
2, 03/03/2020, 1
5, 01/01/2020, 1
5, 02/01/2020, 2
5, 03/01/2020, 3
];
NoConcatenate
Load * ,if(Previous(NUM_CADRE)<>NUM_CADRE,1,peek(CalculatedOrder)+1) as CalculatedOrder;
load * Resident table0 Order by NUM_CADRE,Date;

Drop Table table0;