Im trying to calculate the average times the item “XWO Work Number” (which is a samlple workorder name) appears in each day for 30 days from a xlsx file. While trying the following code Im getting the “right parentesis” error and would appreciate some help now. The code Im using for the xlsx is:
WITH DailyCounts AS (
SELECT
"Made When",
COUNT("XWO Work Number") AS DailyCount
FROM
People_Where
WHERE
"Made When" BETWEEN '2024-05-01' AND '2024-06-01'
GROUP BY
"Made When"
),
TotalCounts AS (
SELECT
SUM(DailyCount) AS TotalCount,
COUNT("Made When") AS TotalDays
FROM
DailyCounts
)
SELECT
TotalCount / CAST(TotalDays AS DECIMAL) AS AveragePerDay
FROM
TotalCounts;