Dear Forum Members:
Please see my data below:
| ProductGroup | Item | DateTime | Value | Qty |
| Grp-01 | Item001 | 18/03/2021 06:12 | 10 | 5 |
| Grp-01 | Item001 | 18/03/2021 06:13 | 9 | 8 |
| Grp-01 | Item001 | 18/03/2021 06:14 | 8 | 2 |
| Grp-01 | Item001 | 18/03/2021 06:15 | 10 | 3 |
| Grp-01 | Item001 | 18/03/2021 06:16 | 2 | 1 |
| Grp-01 | Item001 | 18/03/2021 06:20 | 3 | 2 |
| Grp-01 | Item002 | 18/03/2021 04:12 | 10 | 5 |
| Grp-01 | Item002 | 18/03/2021 06:04 | 9 | 8 |
| Grp-01 | Item002 | 18/03/2021 05:14 | 8 | 2 |
| Grp-01 | Item002 | 18/03/2021 06:11 | 10 | 3 |
| Grp-01 | Item002 | 18/03/2021 06:22 | 2 | 1 |
| Grp-01 | Item002 | 18/03/2021 06:24 | 3 | 2 |
| Grp-01 | Item003 | 18/03/2021 04:12 | 10 | 5 |
| Grp-01 | Item003 | 18/03/2021 06:04 | 9 | 8 |
| Grp-01 | Item003 | 18/03/2021 05:14 | 8 | 2 |
| Grp-01 | Item003 | 18/03/2021 06:11 | 10 | 3 |
| Grp-01 | Item003 | 18/03/2021 06:19 | 2 | 1 |
| Grp-01 | Item003 | 18/03/2021 06:21 | 3 | 2 |
| Grp-01 | Item004 | 18/03/2021 03:12 | 10 | 5 |
| Grp-01 | Item004 | 18/03/2021 03:34 | 9 | 8 |
| Grp-01 | Item004 | 18/03/2021 04:11 | 8 | 2 |
| Grp-01 | Item004 | 18/03/2021 05:41 | 10 | 3 |
| Grp-01 | Item004 | 18/03/2021 06:01 | 2 | 1 |
| Grp-01 | Item004 | 18/03/2021 06:24 | 3 | 2 |
Green and bold rows are the desired output for further analysis, below desired output from the above table:
| ProductGroup | Item | DateTime | Value | Qty |
| Grp-01 | Item001 | 18/03/2021 06:20 | 3 | 2 |
| Grp-01 | Item002 | 18/03/2021 06:22 | 2 | 1 |
| Grp-01 | Item003 | 18/03/2021 06:21 | 3 | 2 |
| Grp-01 | Item004 | 18/03/2021 06:24 | 3 | 2 |
I have groups and each group contains 2 or 4 items, Each group items has more than one row for each day, every row is timestamped.
I need to pick up 2/4 items from each group with the closest datetime matched, if they matched more than 1 as well then all the entries (possibly group by Product Group, Item, Date) but the example above is showing one day entries for the items in a group.
The above is all one dataset.
Do You think this is possible?
thank You in advance.