Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
I have below table data. I want to pick up Min(timestamp) against each cust.
Cust | Timestamp |
Debi | 1/12/2021 9:08 |
John | 4/10/2021 11:08 |
Debi | 1/14/2021 6:43 |
Alex | 3/3/2021 23:11 |
John | 1/16/2021 9:08 |
Sam | 1/17/2021 9:08 |
Sam | 1/18/2021 18:28 |
Expected outcome
Cust | Timestamp |
Debi | 1/12/2021 9:08 |
John | 1/16/2021 9:08 |
Alex | 3/3/2021 23:11 |
Sam | 1/17/2021 9:08 |
So basically I want to show what is oldest transaction time against each customer. I tried various option like using
timestamp(aggr(min(TimeStamp),Cust),'YYYY-MM-dd hh:mm:ss') but it is not calculating correctly. Any ideas ?
Thanks,
C
as per the timestamp provided above, for some reason why i was not able to convert to timestamp, it gave wrong output. so i used makedate and maketime functions recreated the date & time and applied timestamp to get the correct output. applying min on this derived column gave the output.
try this:
=Min(timestamp (MakeDate(
trim(subfield(SubField(Timestamp,' ',1),'/',3))
,trim(subfield(SubField(Timestamp,' ',1),'/',1))
,trim(subfield(SubField(Timestamp,' ',1),'/',2))
) +
MakeTime(
subfield(SubField(Timestamp,' ',2),':',1)
,subfield(SubField(Timestamp,' ',2),':',2)
)))
If your timestamp is correctly read as timestamp (meaning it is dual field with numeric value), you can just create a chart with Cust as your dimension and use TimeStamp(Min(Timestamp)). If it is not read as timestamp, then I suggest fixing that in the script using TimeStamp#() function
TimeStamp(TimeStamp#(Timestamp, 'M/D/YYYY hh:mm')) as Timestamp