Need Clarification on Avg

  • Currently we are calculating all these by dividing expenses by patient days on per building basis but Ideally the expectation is we should add all the expenses and add all the patient days and divide Expenses by Patient Days

This is based on the building selection, Based on the selected buildings the value changes
image
We want to show the last 1 year, 2 years, 5 years and 6 months data. based on the selecting period.
Here we are not using the normal date filter, because we are showing the prior period data as well.
When we trying to use the above calculation not able to call it to the other calculation because already we are using the aggregation.
need help to achieve this requirement.

Instead of taking the average of that you can do sum(expense)/sum(patient_days)

This should get you what you are looking for.

Taking the average over the four buildings is different than the total.