I need to know the sum of the progress.I realize this is a little complex… and maybe I’m making it harder than it is. The data is in dataverse.
3 tables…
Goals
Deliverables
DeliverableStatus
Relationships:
Goals have zero or more deliverables and deliverables have zero or more deliverableStatus.
Below in _ds I capture the latest status and progress for each individual deliverable using the latest deliverable status (based on descending ‘modified on’). All good.
In _d I return all the deliverables for a specific goal.
The CountRows is working to show how many Deliverables they have.
But I want to do a Sum of the Progress of all the Deliverables and I’m struggling where that Sum goes…
Any advice would be appreciated…
With(
{
_ds: ForAll(
GroupBy(
AddColumns(
DeliverableStatuses,
DeliverableGUID,
Deliverable.Deliverable
),
DeliverableGUID,
GroupedItems
),
With(
{
_top: First(
Sort(
GroupedItems,
'Modified On',
SortOrder.Descending
)
)
},
{
Deliverable: DeliverableGUID,
ModifiedOn: _top.'Modified On',
RYG: _top.RYG,
DateComplete: _top.DateComplete,
Progress: _top.Progress,
ActivityOwners: _top.ActivityOwners,
TargetDates: _top.ActivityTargetDates
}
)
)
},
With(
{
_d: ForAll(
_ds As _ddss,
Patch(
_ddss,
{
Goal: LookUp(
Deliverables,
Deliverable = _ddss.Deliverable,
Goal.Goal
)
}
)
)
},
ClearCollect(
colGoalStatus,
ForAll(
Goals As _g,
With(
{
_delivers: Filter(
_d,
Goal = GUID(_g.Goal)
)
},
Patch(
_g,
{
DeliverableCount: CountRows(_delivers),
Progress: 100
}
)
)
)
)
)
)