YOUSEFUL / DELPHI / COMPONENTS
TAtlasMeasure
One aggregate column: the field to read, the result caption and the kind of calculation.
Description
Used by TAtlasAnalytics.Aggregate and TAtlasReportDefinition.GroupBy. Each measure becomes one ackNumber result column named Caption. Captions must be non-empty and differ from each other and from the dimension names. Every kind except amCount needs an ackNumber field. The same field can appear in several measures.
Members
| Member | Kind | What it does |
|---|---|---|
Field | field | The column to read. |
Caption | field | The name of the result column. |
Kind | field | The calculation. |
Create | method | Returns a measure. |
Methods
Create method
class function Create(const Field, Caption: string; Kind: TAtlasMeasureKind): TAtlasMeasure; static;Returns a measure. Nothing is validated until it is used.
TAtlasMeasure.Create('Revenue', 'Average sale', amAverage)Fields
Field field
Field, Caption: string;The column to read. May be empty for amCount; if you give one for amCount it must exist, but every row is still counted.
Caption field
Field, Caption: string;The name of the result column.
Kind field
Kind: TAtlasMeasureKind;The calculation. See TAtlasMeasureKind.
Examples
Every measure over one column
One total row with count, sum, minimum, maximum and average revenue.
uses Atlas.Data, Atlas.Analytics;
function RevenueStatistics(Sales: TAtlasTable): TAtlasTable;
begin
Result := TAtlasAnalytics.Aggregate(Sales, [], [
TAtlasMeasure.Create('', 'Orders', amCount),
TAtlasMeasure.Create('Revenue', 'Total', amSum),
TAtlasMeasure.Create('Revenue', 'Smallest', amMinimum),
TAtlasMeasure.Create('Revenue', 'Largest', amMaximum),
TAtlasMeasure.Create('Revenue', 'Average', amAverage)]);
end;
Related
TAtlasMeasureKind · TAtlasAnalytics · TAtlasReportDefinition