Custom dimensions and measures
Plywood expressions use Druid columns, not Pivot dimensions.
You can build custom dimensions and measures using Plywood. Add a Plywood-based dimension or measure to Pivot by entering it in the Formula field of a New dimension or New measure dialog box. See Creating dimensions and Creating measures for more information.
Prerequisites
Before you can build custom dimensions and measures, you must know the following:
- Dimension fields always start with a
$
character in custom mode. - Measures always start with a
$main
object in custom mode. - Since measures are always aggregated values, the end result of a custom measure must be an aggregated value.
- Plywood functions are case-sensitive.
- Do not add a
;
character to the end of your Plywood expression. - You cannot build custom dimensions and measures based off other custom dimensions and measures.
Build nested or chained Plywood expressions
You can nest or chain Plywood expressions together. For example, if you are familiar with case, when, else
logic from SQL or any programming language, you can create similar logic in Plywood using in, then, fallback
expressions, like this: $cityName.in(['London','Aachen','Abbotsford']).then('Match Found').fallback('No Match')
. fallback
conditions can also contain other expressions, allowing you to create long fallback chains:
($cityName)
.match('London')
.then('A')
.fallback(
($cityName)
.match('Aachen')
.then('B')
.fallback(
($cityName)
.match('Abbotsford')
.then('C')
.fallback('D')
)
)
Examples
For example custom dimensions and measures, see Dimensions and Measures.