According to SQLITE documentation:
The avg() function returns the average value of all non-NULL X within a group. String and BLOB values that do not look like numbers are interpreted as 0. The result of avg() is always a floating point value as long as at there is at least one non-NULL input even if all inputs are integers. The result of avg() is NULL if and only if there are no non-NULL inputs.
Therefore, if you replace the ELSE condition to NULL it should theoretically produce the correct result:
SELECT id,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 0 THEN count ELSE NULL END) as sun,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 1 THEN count ELSE NULL END) as mon,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 2 THEN count ELSE NULL END) as tues,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 3 THEN count ELSE NULL END) as wed,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 4 THEN count ELSE NULL END) as thur,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 5 THEN count ELSE NULL END) as fri,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 6 THEN count ELSE NULL END) as sat
FROM tableOfImportantThings
GROUP BY id;
Update: Good point, CL. Based on your comment the query can be simplified like this:
SELECT id,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 0 THEN count END) as sun,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 1 THEN count END) as mon,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 2 THEN count END) as tues,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 3 THEN count END) as wed,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 4 THEN count END) as thur,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 5 THEN count END) as fri,
AVG(CASE WHEN CAST(strftime('%w', date) AS INTEGER) = 6 THEN count END) as sat
FROM tableOfImportantThings
GROUP BY id;