Nesting Not Allowed - Error

Hello @preyasi, I have a few questions about how you are wanting this to aggregate. There is definitely a way to manage nesting of calculations like this, but I think we can simplify this slightly and avoid the errors. Something that would make this a lot easier to debug would be if you could create and share a demo version of this analysis within Quick Sight Arena. That would allow me to test and share a working version of the calculation with you directly.

As for the calculation, is var(1) a field that you want aggregated at a row level? Comparing these values across a single row then getting the average across all rows? As for the count field, it is probably unnecessary to wrap it in a sum aggregation. You should be able to multiply the count by the average.

My initial thought is to update the var(1) aggregation to look like this:
var(1) = (({var3}*{var4})/{var4})/(({var5}*{var6})/{var6})

Now for the count for that grouping, do you just mean the count of rows that do not return a NULL value for var(1)? You shouldn’t have to do anything special for that. Your final formula should look something like this:

count({var(1)})*avg({var(1)})

Let me know if this helps!