Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
i have the following problem.
I would like to make pairs of the following form:
Arrival | Stage | Departure |
02/11/2021 13:31:27 | 1. Process | 02/11/2021 14:11:38 |
02/11/2021 14:12:02 | 1. Process | 02/11/2021 14:12:03 |
02/11/2021 14:18:27 | 2 Distribucion | 02/11/2021 14:18:28 |
02/11/2021 14:50:42 | 1. Process | 02/11/2021 15:03:51 |
02/11/2021 15:10:41 | 2 Distribucion | 02/11/2021 15:10:42 |
pairs should be as follows:
Pair | Arrival | Stage | Departure |
1 | 02/11/2021 13:31:27 | 1. Process | 02/11/2021 14:11:38 |
1 | 02/11/2021 14:12:02 | 1. Process | 02/11/2021 14:12:03 |
1 | 02/11/2021 14:18:27 | 2 Distribucion | 02/11/2021 14:18:28 |
2 | 02/11/2021 14:50:42 | 1. Process | 02/11/2021 15:03:51 |
2 | 02/11/2021 15:10:41 | 2 Distribucion | 02/11/2021 15:10:42 |
Every time find a stage 2 Distribution before stage 1. Process a pair must be made
Thank you
maybe like this?
LOAD Arrival,
Stage,
Departure,
Alt(Peek(Pair),1)-(Stage='1. Process' and Previous(Stage)='2 Distribucion') as Pair
FROM [https://community.qlik.com/t5/QlikView-App-Dev/Create-Pairs/m-p/1867660](html, codepage is 1252, embedded labels, table is @1);
hope this helps
Marco
Thank you very much, so far it works for me, I am going to try other similar cases but where there are more stages 1. Process.
You saved my life
maybe like this?
LOAD Arrival,
Stage,
Departure,
Alt(Peek(Pair),1)-(Stage='1. Process' and Previous(Stage)='2 Distribucion') as Pair
FROM [https://community.qlik.com/t5/QlikView-App-Dev/Create-Pairs/m-p/1867660](html, codepage is 1252, embedded labels, table is @1);
hope this helps
Marco
Thank you very much, so far it works for me, I am going to try other similar cases but where there are more stages 1. Process.
You saved my life
glad it worked.
Please close your thread by accepting a solution once your tests are finished.
thanks
Hello friend,
I have a problem and it is that by including more data it is not creating several pairs like this in the table but rather it creates a single one, in that case how could it be solved?
air | Arrival | Stage | Departure | Trx |
1 | 02/11/2021 13:31:27 | 1. Process | 02/11/2021 14:11:38 | C01 |
1 | 02/11/2021 14:12:02 | 1. Process | 02/11/2021 14:12:03 | C01 |
1 | 02/11/2021 14:18:27 | 2 Distribucion | 02/11/2021 14:18:28 | C01 |
2 | 02/11/2021 14:50:42 | 1. Process | 02/11/2021 15:03:51 | C01 |
2 | 02/11/2021 15:10:41 | 2 Distribucion | 02/11/2021 15:10:42 | C01 |
3 | 03/11/2021 13:31:27 | 1. Process | 03/11/2021 14:11:38 | C02 |
3 | 03/11/2021 13:31:27 | 1. Process | 03/11/2021 14:12:03 | C02 |
3 | 03/11/2021 14:18:27 | 2 Distribucion | 03/11/2021 14:18:28 | C02 |