Aggregation of Aggregation as a KPI

I need to calculate the average difference between two dates but at a group level different than the base

Like the image above, if I calculate straight the average from the difference it gives me difference for all lines (7.93).

I want to calculate the difference grouping by ID and display the value as a KPI(9.83).

I believe I need a combination of average over and max and maybe a calculated field at the dataset but all my tries cames as errors or wrong results.

Any insight is helpful

Does this work?

avgOver(max(dateDiff({arrival_timestamp},{session_start_timestamp})),[{client_id[users]}])