Recursively sum child’s nominal to parent, on dynamic level parent-child structure
I have data that looks like this
Understanding performance lag on a simple cte
I am trying to calc carryover of PTO hours from one year to the next. In order to do this, I need to know the previous year’s “remaining balance”, which requires knowing the previous year’s Hours Used AND the previous year’s Carryover. This puts me in a “turtles all the way down” scenario, where I need to reference (prior) carryover in order to calc (current) carryover, going back forever.
Calculate value based on sum of previous calculated values
What needs to happen: create a new column called AdjustedAllocation by taking the IncrementedSourceRatio and multiplying it by the original AllocationAmount LESS the SUM of all previous AdjustedAllocation for that participant.
Calculate value based on sum of previous calculated values
What needs to happen: create a new column called AdjustedAllocation by taking the IncrementedSourceRatio and multiplying it by the original AllocationAmount LESS the SUM of all previous AdjustedAllocation for that participant.
Create a Task Sheet By CTE
In SQL Server I have a table named task with columns: task_id, task_name, task_weight, task_parent. the task_parent column is a foreign key which may be null or be related to another task_id in this table. I want to write a CTE to show tasks in a sheet like MS Project where task_weight of atask row with some recursive children, is summarized from its children and level of each child is calculated based on its recursive parents. Each child may have another child and so on. So consider this to calculate top level weight.