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

Max And Min

Hello Friends

I have the following problem:

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

I have some pairs of data, but I would like to get the max and minimum, for example for the case of 1. Process would be the first Arrival that is, 11/02/2021 13:31:27 with the pair 1 Max Arrival (2 Distribution)

in the end they should look like this:

Pair Arrival Stage Departure
1 02/11/2021 13:31:27 1. Process 02/11/2021 14:11:38
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

 

Thanks a lot

1 Solution

Accepted Solutions
Or
MVP
MVP

If the dates are strings rather than actual dates, you can use MinString and MaxString. If the dates are actual dates and you are just looking at the format being changed to a number, you can use Date(Min()) and Date(Max()) to re-format as date.

View solution in original post

3 Replies
Or
MVP
MVP

It sounds like a simple group by with min and max, but your sample doesn't match the text description - the max of the Departure for the first row would be 02/11/2021 14:12:03 in that case. If that's an error, it should be just a case of

Load Pair, Stage, Min(Arrival) as Arrival, Max(Departure) as Departure

From YourTable

Group By Pair, Stage;

Aldemarprins4
Contributor III
Contributor III
Author

Thanks it worked but, the dates are lost when doing the max and min

 

However I will try to fix it ...


Thanks a lot

Or
MVP
MVP

If the dates are strings rather than actual dates, you can use MinString and MaxString. If the dates are actual dates and you are just looking at the format being changed to a number, you can use Date(Min()) and Date(Max()) to re-format as date.