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

Selecting one row from many based on the value in one column

Hi all, I need help with how to write a script.

I am sure this is really simple, but I am trying to select the only one row of data with multiple columns based on the value in one of the columns.

For example, I have the following data

ShipmentEvent TypeDate OccuredDate Submitted
12345Estimated deliveryJuly 1, 2013June 25, 2013
12345Estimated deliveryJune 30, 2013June 24, 2013
abcdeActual deliveryJune 14, 2013June 14, 2013
abcdeEstimated deliveryJune 14, 2013June 10, 2013

but I would like to get only the most recent date occured per shipment, per event type. see below.

ShipmentEvent TypeDate OccuredMost recent Date Submitted
12345Estimated DeliveryJuly 1, 2013June, 25, 2013
abcdeActual DeliveryJune 14, 2013June 14, 2013
abcdeEstimated DeliveryJune 14, 2013June 10, 2013

I thought I could do something like

New Table:

noconcatenate

load distinct

[Shipment],

[event type],

[Date occured],

max([date Submitted]) as [most recent date submitted]

resident old table

group by [shipment],[event type], [date occured];

however since the date occured is different, I get two rows... I cant guarantee that the date something occured is the larger or smaller. In other words the date submitted has nothing to do with when it was submitted or previous dates, it can go up or down. I just need to only capture the most recent one.

Any help would be appreciated.

Thanks

10 Replies
Not applicable
Author

Not sure I understand why you would need a developer to do simple thing like showing the max to take your data from multiple rows to single rows per max ? Is Qlikview not capable of multi-dimensional analysis?

This should be a function of the properties in sheet objects, like other tools.