YOUSEFUL / DELPHI / COMPONENTS

TAtlasMeasure

One aggregate column: the field to read, the result caption and the kind of calculation.

Record Unit Atlas.Analytics · Product Atlas Analytics

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

MemberKindWhat it does
FieldfieldThe column to read.
CaptionfieldThe name of the result column.
KindfieldThe calculation.
CreatemethodReturns 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.

pascal
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.

pascal
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;

TAtlasMeasureKind · TAtlasAnalytics · TAtlasReportDefinition

Also in Atlas Analytics

TAtlasReportDefinition · TAtlasDashboard