Add Custom Dimensions and Measures
A grasp of these concepts will help you understand this documentation better:
This is where things start to get interesting. in Holistics, you can create Custom Dimensions and Measures to assist your data exploration.
Custom Dimensions are created from non-aggregate functions that transform existing model fields, and Custom Measures are aggregate functions like SUM
, AVG
, MIN
, MAX
... that summarize your data across some dimensions.
Basic aggregations are provided in Holistics's Data Exploration UI, but with Custom Measures you can specify more complicated calculations like conditional SUM
.
Without further ado, let's dive right in!
Navigate to
movies_metadata
model, and click Add fieldClick Custom dimension to start adding a new dimension.
Enter a unique field name that does not exist in the current model, in this case,
budget_range
. Holistics will automatically translate the field name to a user-friendly Field LabelThe formula used in a Custom Dimension must not contain aggregation functions. In this case, we enter a series of CASE... WHEN... to group movies' budget into different groups:
case
when {{#THIS.budget}} < 1000000 then 'Under $1mil'
when {{#THIS.budget}} >= 1000000 and {{#THIS.budget}} < 5000000 then '$1mil - $5mil'
when {{#THIS.budget}} >= 5000000 and {{#THIS.budget}} < 10000000 then '$5mil - $10mil'
when {{#THIS.budget}} >= 10000000 and {{#THIS.budget}} < 20000000 then '$10mil - $20mil'
when {{#THIS.budget}} >= 20000000 and {{#THIS.budget}} < 50000000 then '$20mil - $50mil'
when {{#THIS.budget}} >= 50000000 and {{#THIS.budget}} < 100000000 then '$50mil - $100mil'
when {{#THIS.budget}} >= 100000000 and {{#THIS.budget}} < 200000000 then '$100mil - $200mil'
when {{#THIS.budget}} >= 200000000 and {{#THIS.budget}} < 300000000 then '$200mil - $300mil'
when {{#THIS.budget}} >= 300000000 then 'Over $300mil'
else null endYou can click on the fields on the left to populate the formula with the field reference syntax.
Click Create to finish. The newly created dimension will be signified with a small blue dot
Click Add field → Measure to create a simple
all_movies_count
measures that count all movies available in the dataset.This is equivalent to choosing COUNT aggregation on the Movie ID field in the Exploration UI.
Click Create to finish.
If you want to quickly check how the newly created dimensions and measures look like, you can switch to the Preview tab, drag in the new fields and click Get Result