150 likes | 272 Views
Explore the capabilities of OData extensions for data aggregation in this insightful document. Learn how to effectively use aggregations in your API requests, employing various functions like sum and max, while handling complex hierarchies and rolling up data. Understand the use of filters, ordering, and the significance of annotations in data aggregation. This guide also delves into advanced topics such as hierarchy-based functions and merging selection with aggregation in queries, providing a comprehensive overview for data analytics and management professionals.
E N D
OData Extensions for Data Aggregation Ralf Handl, SAP Siva Harinath, Microsoft Hubert Heijkers, IBM Gerald Krause, SAP Mike Pizzo, Microsoft July 26th, 2012
GET ~/Sales?$select=Product,Amount &$aggregate=Amount
GET ~/Sales?$select=Product,Amount &$aggregate=Amount&$orderby=Amount desc
GET ~/Sales?$select=Product,Amount &$aggregate=Amount&$filter=Amount ge 8
GET ~/Sales?$select=Product,Revenue &$aggregate=sum(Amount) as Revenue&$filter=Amount ge 8
GET ~/Sales?$select=Product,Amount,MaxAmount &$aggregate=sum(Amount) ,max(Amount) as MaxAmount
GET ~/Sales?$select=Product,Amount &$aggregate=Amount ,count(*) as SalesCount
Measures <PropertyName="Amount"Type="Decimal"> <TypeAnnotationTerm="DataAggregation.DependentMeasure"> <PropertyValueProperty="DefaultAggregationFunction" String="sum"> <PropertyValueProperty="AcceptedAggregationFunctions"> <Collection> <String="sum"/> <String="max"/> </Collection> </PropertyValue> </TypeAnnotation> </Property>
Hierarchies <PropertyName="ProductGroup"Type="String"Nullable="false" /> <PropertyName="Product" Type="String"Nullable="false" /> <TypeAnnotationTerm="DataAggregation.LeveledHierarchy"> <PropertyValueProperty="Name"String="ProductHierarchy"/> <PropertyValueProperty="Levels"> <Collection> <String="ProductGroup"/> <String="Product"/> </Collection> </PropertyValue> </TypeAnnotation>
Open Topics • Links for „drillinginto“ aggregatedentities • More hierarchytypes: parent-child, ragged, … • Hierarchy-basedfunctions: descendants(), siblings() • Expressionsin $aggregate: sum(Revenue) - sum(Costs) asProfit • Split into $filter and $postfilter (WHERE/HAVING) • Merge$aggregateand $select, implicit $expand • Set functions for complex aggregations: ~/MySet/$Select(city,sales)/$Aggregate(sales)/$Select(sales)/$Aggregate() • References to annotations for units/currencies/texts