Preview:
WITH
customer AS (
	SELECT Customer_Code, PU_Area_Code 
	FROM ops.tbl_Dim_ICC_Customer 
	WHERE ETL_Current_Row = 1
)
SELECT
	PU_Area_Code, COUNT( StopcustomerCode ), AVG( DATEDIFF ( minute, arrivalcalltimestamputc, departurecalltimestamputc ) ) utctimestamp
FROM [mvtebi_dw_ops].[dw_ops].[platsci].[amqp_dispatchstops] AMQP
LEFT JOIN ops.tbl_Dim_ICC_Customer cust
	ON amqp.stopcustomercode = cust.Customer_Code
WHERE arrivalcalllatitude - departurecalllatitude < .007 AND DATEDIFF ( minute, arrivalcalltimestamputc, departurecalltimestamputc ) > 4 AND StopRemovedTimestampUTC IS NULL
GROUP BY PU_Area_Code

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter