I want to create a capacity heat map in ZOHO. The first step was to develop this query (below) to determine the "Capacity Start Date" , "Hours p/Day Remaining", and "Scheduled End Date." Now that I have all that, I want to create a new query that will essentially reference the one below, but spread those "Hours p/Day Remaining" across all the days between "Capacity Start Date" and "Scheduled End Date" by the Department, Network ID, etc.
SELECT
"JobStatus" AS "Job Status",
"Division" AS "Division",
"DepartmentName" AS "Department",
"CustomerName" AS "Customer",
"Network" AS "Network",
"EstStartDate" "Scheduled Start Date",
"EstEndDate" AS "Scheduled End Date",
"ActStartDate" AS "Actual Start Date",
"ActEndDate" AS "Actual End Date",
"EstimatedHours" AS "Budgeted Hours",
"ActualHours" AS "Hours Consumed",
"Remaining Hours",
to_integer(date_diff("EstEndDate", current_date())) AS "Remaining Days",
"Remaining Hours" / to_integer(date_diff("EstEndDate", current_date())) AS "Hours p/Day Remaining",
"Budget Consumed Percent_Reference Only" * 100 AS "% Of Budget Consumed",
"PercentComplete" * 100 AS "POC",
"Kickoff Date",
"Dock Date",
"PM",
"QA",
"LB",
(row_number() over()) AS "Auto Number",
add_date("EstEndDate", ROUND("Remaining Hours" / -24)) AS "Latest Start Date",
find_max_value(add_date("EstEndDate", ROUND("Remaining Hours" / -24)), current_date()) AS "Capacity Start Date",
to_integer(date_diff("EstEndDate",find_max_value(add_date("EstEndDate", ROUND("Remaining Hours" / -24)), current_date()))) AS "Capacity Remaining Scheduled Days"
FROM "Eagle_AllHoursReport"
WHERE "JobStatus" IN ( 'In Process' )
AND "EstEndDate" - current_date() >= 1
AND "Remaining Hours" >= .01