Labels Query in Data Summary
Labels Query
With the Labels query you can create your own category that will base the calculations on transactions having specific labels assigned if you’re using the Labeling service. In the Data Summary response, your query will become the category name with calculated metrics within.
Format description
The Labels Query contains:
- “label” keyword with a semicolon (:)
- required inclusion section: label names separated by ampersand (&) or pipe sign (|)
- you can provide from 1 to up 5 labels in the inclusion section
- labels separated by & mean: include transactions that contain at least all of the provided labels
- labels separated by | mean: include transactions that contain at least any of the provided labels
- you can’t mix & and | in one inclusion section
- optional exclusion section preceded by the tilde sign (~) with labels names separated by pipe sign (|)
- you can provide from 1 to 5 labels in the exclusion section
- labels in the exclusion section mean: exclude all transactions that contain at least any of the provided labels
The format requires label names as per our documentation.
Label names may contain spaces. Only :, &, | and ~ are allowed in the query as special characters.
“at least” in the descriptions means that the transactions can have any number of other labels that are not mentioned in the query and they will still be considered for the calculations.
The constructs in the table present examples that should either match or not with the required format:
Correct | Incorrect |
---|---|
label:a |
label:a~ |
label:a&b&c |
label:a&b|c |
label:a|b|c |
label:a|b&c |
label:a~b |
label:a&b&c&d&e&f |
label:a&b~c |
label:a~b&c |
label:a&b~c|d |
label:a|b~c&d |
label:a|b|c~d|e |
label:a~b|c|d|e|f|g |
label:a&b&c&d&e |
label:(a|b)&c |
label:a&b&c&d&e~f|g|h|i|j |
label:~a |
Usage examples
Given transactions with the following labels:
- car
- e commerce
- leasing
- invoice
- car, e commerce
- car, leasing
- car, invoice
- e commerce, leasing
- e commerce, invoice
- leasing, invoice
- car, e commerce, leasing
- car, e commerce, invoice
- car, leasing, invoice
- e commerce, leasing, invoice
- car, e commerce, leasing, invoice
The following queries will cause Data Summary to process specific transactions:
Labels query | Query explanation | Included transactions |
---|---|---|
label:car |
Include transactions that have car label assigned | 1, 5, 6, 7, 11, 12, 13, 15 |
label:car&leasing |
Include transactions that have both car and leasing labels assigned | 6, 11, 13, 15 |
label:car|leasing |
Include transactions that have either car or leasing labels assigned | 1, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15 |
label:car&leasing~invoice |
Include transactions that have both car and leasing labels assigned but don’t have invoice label | 6, 11 |
label:car|leasing~invoice|e commerce |
Include transactions that have either car or leasing labels assigned but don’t have invoice or e commerce labels | 1, 3, 6 |