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.
Syntax:
Concat({[SetExpression] [DISTINCT] [TOTAL [<fld{, fld}>]]} string[, delimiter[, sort_weight]])
Return data type: string
Arguments:
Argument | Description |
---|---|
string |
The expression or field containing the string to be processed. |
delimiter | Each value may be separated by the string found in delimiter. |
sort-weight |
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. |
TOTAL |
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. By using TOTAL [<fld {.fld}>], where the TOTAL qualifier is followed by a list of one or more field names as a subset of the chart dimension variables, you create a subset of the total possible values. |
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 |
---|---|
Concat(Team) |
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:
TeamData:
LOAD * inline [
SalesGroup|Team|Date|Amount
East|Gamma|01/05/2013|20000
East|Gamma|02/05/2013|20000
West|Zeta|01/06/2013|19000
East|Alpha|01/07/2013|25000
East|Delta|01/08/2013|14000
West|Epsilon|01/09/2013|17000
West|Eta|01/10/2013|14000
East|Beta|01/11/2013|20000
West|Theta|01/12/2013|23000
] (delimiter is '|');
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!