Concat - chart function

Concat() is used to combine string values. The function returns the aggregated string concatenation of all the values of the expression evaluated over each dimension.


Concat({[SetExpression] [DISTINCT] [TOTAL [<fld{, fld}>]] string[, delimiter[, sort_weight]])

Return data type: string


Argument Description

The expression or field containing the string to be processed.

delimiter Each value may be separated by the string found in delimiter.

The order of concatenation may be determined by the value of the dimension sort-weight, if present, with the string corresponding to the lowest value appearing first in the concatenation.

SetExpression By default, the aggregation function will aggregate over the set of possible records defined by the selection. An alternative set of records can be defined by a set analysis expression.
DISTINCT If the word DISTINCT occurs before the function arguments, duplicates resulting from the evaluation of the function arguments are disregarded.

If the word TOTAL occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions.

The TOTAL qualifier may be followed by a list of one or more field names within angle brackets <fld>. These field names should be a subset of the chart dimension variables.

Defining the aggregation scope

Examples and results:  

SalesGroup Amount Concat(Team) Concat(TOTAL <SalesGroup> Team)
East 25000 Alpha AlphaBetaDeltaGammaGamma
East 20000 BetaGammaGamma AlphaBetaDeltaGammaGamma
East 14000 Delta AlphaBetaDeltaGammaGamma
West 17000 Epsilon EpsilonEtaThetaZeta
West 14000 Eta EpsilonEtaThetaZeta
West 23000 Theta EpsilonEtaThetaZeta
West 19000 Zeta EpsilonEtaThetaZeta
Example Result

The table is constructed from the dimensions SalesGroup and Amount, and variations on the measure Concat(Team). Ignoring the Totals result, note that even though there is data for eight values of Team spread across two values of SalesGroup, the only result of the measure Concat(Team) that concatenates more than one Team string value in the table is the row containing the dimension Amount 20000, which gives the result BetaGammaGamma. This is because there are three values for the Amount 20000 in the input data. All other results remain unconcatenated when the measure is spanned across the dimensions because there is only one value of Team for each combination of SalesGroup and Amount.

Concat(DISTINCT Team,', ') Beta, Gamma. because the DISTINCT qualifier means the duplicate Gamma result is disregarded. Also, the delimiter argument is defined as a comma followed by a space.
Concat (TOTAL <SalesGroup> Team) All the string values for all values of Team are concatenated if the TOTAL qualifier is used. With the field selection <SalesGroup> specified, this divides the results into the two values of the dimension SalesGroup. For the SalesGroupEast, the results are AlphaBetaDeltaGammaGamma. For the SalesGroupWest, the results are EpsilonEtaThetaZeta.
Concat (TOTAL <SalesGroup> Team,';', Amount) By adding the argument for sort-weight: Amount, the results are ordered by the value of the dimension Amount. The results becomes DeltaBetaGammaGammaAlpha and EtaEpsilonZEtaTheta.

Data used in example:


LOAD * inline [











] (delimiter is '|');