ERROR: 'Getting data for this visualization took too long'

I am seeing this error on many of my views in the dashboard. This error only occurs on a specific calculations which is of the form sum(avg(a, [b,c,d])).Is there a way to optimize this calculation? Also, the dataset is in SPICE but it is pretty large (500GB). Is there a way to partition the data to improve performance?
Screen Shot 2023-06-14 at 8.49.46 AM

Hi @Chirag_Karkera

Can you move any of this logic to the query?

Maybe try and do an avg of a in a query to help save some compute.

Hi @Max
Unfortunately, I can’t do that. Our dashboard needs both aggregated and unaggregated data in it. So I need to granular unaggregated data in the dataset. This enables me to aggregate data in views.

Hi @Chirag_Karkera
Maybe try using AvgOver() instead of avg(). Documentation below