Child pages
  • Simple CDS Query with Exception Aggregation AVG
Skip to end of metadata
Go to start of metadata

Analytic Engine only supports default aggregation SUM, MIN, MAX. To use other aggregation such as AVG, exception aggregation can be defined in a CDS query.
For COUNT, follow this example

 In the InfoProvider CDS, key figure NumberOfFreeSeats is defined with default aggregation SUM.

 

In a CDS query, exception aggregation AVG can be defined on key figure NumberOfFreeSeats with reference field Airline in a formula 

Run this query 2CZGL_FAGGR2V in transaction RSRT:

Here, the first key figure 'Total Free Seats' uses the default aggregation SUM. Formula 'Average Free Seats' uses exception aggregation AVG.

Note the exception aggregation is calculated according to the reference field 'Airline' only. Remove 'Airline' from drill down, the query result is the same. See more details about exception aggregation here.

More reference fields can be used to get average values:

The query result is as below:

Average Free Seats for Airline AA = Total Free Seats / 2 = 372 / 2 = 186

Average Free Seats for all airlines =  Total Free Seats / 6 = 960 / 6 = 160.

 

See also:

CDS View Example 10

 

 

 

 

  • No labels