Reaggregation Scenario 3: Average period value for semi-additive numbers I
Semi-additive numbers may be aggregated across some, but not all, dimensions. They commonly apply to specific time positions. In this scenario, we have daily position values for home loans, and therefore cannot aggregate on the date dimension.
Valid solution
A valid query that meets our objective may look something like this:
average(group_aggregate(sum(loan balance), query_groups() + {date(balance date)}, query_filters()))
Resolution
-
The
sum(loan balance)
function aggregates to the following attributes:-
{date(balance date)}
andquery_groups()
Add additional search columns to this aggregation. Here, this at the
yearly
level. -
query_filters ( )
Applies any filters entered in the search. Here, there are no filters.
-
-
The
sum(loan balance)
function returns a result for each row in this virtual table. -
The outer
average()
function reaggregates the final output as a single row for eachyear
value.