However when I try to use this in formula below results do not generate expected results.
( {current_balance} - avgOver({current_balance}, [{screen_group}, tier1, tier2, tier3, tier4, tier5, {account - desc}], PRE_FILTER) )
/ abs(avgOver({current_balance}, [{screen_group}, tier1, tier2, tier3, tier4, tier5, {account - desc}], PRE_FILTER)) * 100
This should generate Calculate the Difference:
Calculate the Difference: Difference=25,000−733.33=24,266.67
Calculate the Percent Difference: Percent Difference=(733.33/24,266.67)×100≈3,312.00%
However I see result of
I am confused as to why the avgover works as stand alone calculation but not in second calculated field.
@Sanders77 , not sure, but probably you see a result of aggregation. In plain words, if this result is collected from many rows, you are aggregating precents instead of aggregating {current_balance}. If there are many rows with very small amounts it probably could affect results, but the difference seems to be too big for this. Anyway, you could try something like this:
afraid adding sum to current_balance results in error below.
Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination.
You are correct on dropping the * 100 at end and change to percent. However afraid that still leaves question of why calculation is different from one calculated field is different when same algorithm is used in larger calculated field.
Are you still working through this issue or were you able to find a solution?
The error happens because of the LAC functions. To troubleshoot could you try sumOver({current_balance}, [], PRE_FILTER). Let me know if that gives a new error or the same error.
For nesting aggregations I recommend checking out this blog from a community expert: