Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is the simplest type of metric. It returns the sum (function_sum) of all basket amounts (property baskets.amount).

All available functions and operators are described below.

Code Block
titleTurnover metric object syntax
{
    "name": "turnover_metric",
    "type": "metric",
    "content": {
        "type": "function_sum",
        "content": [
            {
                "type": "property",
                "value": "baskets.amount"
            }
        ]
    }
}

...

KeyTypeOptionalityDescriptionConstraints
typestring
Status
colourRed
titleREQUIRED
dwh query property, dwh query function, or a number

[dwh query functionproperty, number, variable]

contentarray
Status
colourRed
titleREQUIRED

array of dwh property definitions (see the content.content table)


optionsobject
Status
colourGreen
titleoptional
function options, allows to specify filters

...

Some metrics are not computable when aggregated to certain datasets. Say we have a 3-level hierarchical administrative units - districts, wards and postcodes. But the business data is available only up to the 2nd level - wards.

Drawio
contentId644251843
simple0
zoom1
simpleinComment0
inCommentcustContentId0644251843
pageId120336991custContentId644251843
diagramDisplayNameacceptAggregateBy.xml
lbox1
contentVer2
revision2
baseUrlhttps://clevermaps.atlassian.net/wiki
diagramNameacceptAggregateBy.xml
pCenter0
aspectundefined
width401
links
tbstyle
height131

...

KeyTypeOptionalityDescriptionConstraints
propertystring
Status
colourRed
titleREQUIRED

identifier of a dataset property, which the filter will be applied to

{datasetName}.{datasetProperty}
value

string

long

decimal

boolean

Status
colourYellow
titleVARIES

value, by which the property will be filtered

this key is polymorphic - it doesn't have only one type

it can also be a single value, or an array:

  • for the in operator, specify an array of values
  • for all the other operators, use single value

(warning) only one of value and query keys can be specified


queryobject
Status
colourYellow
titleVARIES

query, by which the property will be filtered (see the content.content table)

(warning) only one of value and query keys can be specified


operatorobject
Status
colourRed
titleREQUIRED

the operator that will be used by the filter

see the available filterBy operators


filterBy examples

Code Block
titlefilterBy syntax excerpt with string value and eq operator
collapsetrue
    "filterBy": [
        {
            "property": "shops.type",
            "value": "partner",
            "operator": "eq"
        }
    ]

...

IdentifierDescriptionExample
function_round

a rounding function (round to specific number of places)

function_round(56.157094235, 1) = 56.2

...

IdentifierDescriptionExample
eqis equal

input values: ["apple","orange","banana"], eq = "orange"

result: ["orange"]

nenegated

input values: ["apple","orange","banana"], ne = "orange"

result: ["apple","banana"]

inin range

input values: [1,2,3,4,5,6,7,8], in = [3,6]

result: [3,4,5,6]

ltlower than

input values: [1,2,3,4,5,6,7,8], lt = 5

result: [1,2,3,4]

ltelower than or equal

input values: [1,2,3,4,5,6,7,8], lte = 5

result: [1,2,3,4,5]

gtgreater than

input values: [1,2,3,4,5,6,7,8], gt = 5

result: [6,7,8]

gtegreater than or equal

input values: [1,2,3,4,5,6,7,8], gt = 5

result: [5,6,7,8]

isNullis null

input values: [1,2,3,4,null,6,7,8], isNull = 2

result: false

isNotNullis not null

input values: [1,2,3,4,null,6,7,8], isNotNull = 2

result: true

inAttributeis in attributesee the usage in a complete metric example above
notInAttributeis not in attributecomplementary to the inAttribute example 

...