I've been trying to write a query on big query to get the difference between two times (Created at and resolved at) and get the average of it grouped by day.
This is the query I wrote:
SELECT
avg(datetime_diff(datetime(stats.resolved_at), datetime(created_at), HOUR)) as Difference,
date(tickets.created_at)
FROM fresh_desk.tickets
WHERE
type = "Revision Request"
OR type = "Proof request"
AND stats.first_responded_at is NULL
GROUP BY date(tickets.created_at)
The results are showing by date itself but when I'm building charts over this data on a BI tool, I'm getting the results with date grouped by timestamp as well. How can I avoid this to have the date grouped by day and nothing else? It should show average by day.