CombinedDimension
  • 1 Minute to read
  • Dark
    Light
  • PDF

CombinedDimension

  • Dark
    Light
  • PDF

Article summary

General Functions: CombinedDimension

Create a new discrete string field by joining up to 6 discrete fields together.   Field Values are separated with underscores..

Purpose

Use this function to:

  • Build unique keys for creating joins
  • Create an input field for performing a FirstDiscrete on one or more fields

Return Value

FieldType

String

FieldSize

Low - Med - High

DataType

Discrete

DataSize

Byte / Short / Integer

[field1Value]_[field2value]

e.g.

clothes_2020-01-12

Parameters

Component

JSON

Description

Table

“targetTable”: “MyTableName”

The target table on which the new field will be created

Filter

“dataset”: {DataSet_JSON}

Optional. Must come from target table. Records not in the filter will have a null value in the resulting field.

Fields [1-6]

“p1”: “Field1Name”

“p6”: “Field6Name”

All fields must come from target table.

All discrete Field Types are supported.

At least 1 field must be specified

If a continuous key field needs to be used in a combined dimension, first transform the key field using the CONCAT function.

Include Null

“includeNull”:

If selected/true, then any null values in Fields1-6 will be included and denoted using null.

e.g.

clothes_null or null_2019-0101

JSON sample

{
  "method": "BuildBakedField",
  "project": "D3",
  "targetTable": "transactions",
  "overwrite": true,
  "name": "key-date2",
  "function": "combineddimension",
  "includeNull": true,
  "p1": "date",
  "p2": "product",
  "dataSet": {
    "logic": "or",
    "name": "yearqtr_20191",
    "strict": true,
    "set": [
      {
        "logic": "and",
        "stype": "FIELD",
        "entity": {
          "type": "field",
          "name": "transactions.yearqtr",
          "table": "transactions",
          "valueFilter": []
        },
        "op": "=",
        "values": [
          "20191"
        ]
      }
    ]
  }
}

Usage Notes

It is possible for the combination of values for the specified fields to exceed the maximum calculation size for the function. If this happens, use CombinedDimension more than once in order to create the required result 

Example

Create product-date key field

  • Table: = Transactions
  • Function: = CombinedDimension
  • Filter:= [No Filter]
  • Field 1: = product
  • Field 2: = date
  • Include Null = False
  • Name = product-date

Create product-date key field - include nulls

  • Table: = Transactions
  • Function: = CombinedDimension
  • Filter:= [No Filter]
  • Field 1: = product
  • Field 2: = copy_date_2020
  • Include Null = True
  • Name = product-date

 

Create product-date key field for 2020 only

  • Table: = Transactions
  • Function: = CombinedDimension
  • Filter:= [Year=2020]
  • Field 1: = product
  • Field 2: = copy_date_2020
  • Include Null = False
  • Name = product-date

 


Was this article helpful?