I'm looking for suggestions how to calculate from more records than the delegation limit without repeating code.
I have thousands of records in Dataverse from where I need to calculate the count of the records, sum of certain numbers etc. I was thinking of making a context variable of each of them to avoid delegation but this results in repeating the same code.
Here is a sample:
UpdateContext(
{
locUnit_theory_duration_in_minutes:
Sum(
ShowColumns(
Filter(
'Theory Trackers',
TheoryUnit = locSelectedUnit,
cbTrainingTypeFilterStats.Selected.Result = "All Training Types" Or TheoryTrainingType = cbTrainingTypeFilterStats.Selected.Result,
TheoryDate >= locStartDate And TheoryDate <= locEndDate
),
"cr0c1_instructoruserid",
"crbc8_instructor",
"crbc8_name",
"crbc8_theorydate",
"crbc8_theorydurationinminutes"
),
crbc8_theorydurationinminutes
),
locUnit_theory_count:
Text(
CountRows(
ShowColumns(
Filter(
'Theory Trackers',
TheoryUnit = locSelectedUnit,
cbTrainingTypeFilterStats.Selected.Result = "All Training Types" Or TheoryTrainingType = cbTrainingTypeFilterStats.Selected.Result,
TheoryDate >= locStartDate And TheoryDate <= locEndDate
),
"cr0c1_instructoruserid",
"crbc8_instructor",
"crbc8_name",
"crbc8_theorydate",
"crbc8_theorydurationinminutes"
)
)
)
}
);
Any suggestions how to handle this better?