Analyze and optimize formulas with the Formula Playground

  • 21 December 2021
  • 0 replies

Userlevel 5
Badge +3

The Formula Playground is a tool that allows you to test the outputs of formulas before entering them into a Metric. This feature is extremely useful when you want to troubleshoot your formulas, understand the impact of Dimension modifiers and identify the source data and dimensionality of Blocks used in your formula without affecting/loosing your current view. This article will cover the two modes of Formula Playground, Auto and Custom.


Table of contents



What is Formula playground?


Formula playground is a tool that allows you to test the outcome of a formula in a developmental environment before pushing into the live environment. This is incredibly powerful for troubleshooting formulas or identifying the output of a formula before creating a metric.  There are two modes, Custom and Auto, the main difference between these modes is how they handle the structure of a metric. Auto mode defined the data type and dimensions used based upon the formulas output. In Custom mode, you define the dimensions and data type manually, while you write your formula.


How do you access the Formula Playground?


Once in an Application, the Formula playground is always a click away on the Sidebar. 

You can also access it from within a Metric, on the far right.  



When creating a metric from a formula, Pigment will automatically open up Formula playground if you choose Create from Formula. 



How do you use the Formula Playground?


Once you launch formula playground, the first important decision is what mode do you want to be in. If you want to define the dimensions and resulting data type, use Custom. This is helpful for troubleshooting a particular formula for a metric or for writing a formula where you already know the desired outcome. If you want to let the formula define the dimensions and resulting data type, choose Auto.


The Formula Playground offers all standard features you have on Metrics except Manual inputs and View management. 

If you want to "save" the result of your formula, use the "Create Metric" button on the top right. It will generate a new Metric with the correct type and Dimensions.


Automatic structure mode 

When you write a formula directly in a Metric, the very first step is to define the data type and to select the Dimension(s) of that Block. This comes with two constraints:

  • Data type: if the resulting data type from the formula does not match the Metric’s data type you will get an error. 
  • Dimensions: if the formula's Dimensions don't match the Block Dimensions an automated hidden Dimensions alignment process is applied. Missing Dimensions are added with a constant allocation. Dimensions in surplus are removed with a default aggregation (SUM for numbers). 

With the Formula Playground in Automatic structure mode, those two constraints are removed. You can evaluate a formula as it is, without having to know the type nor Dimensions beforehand.

The formula playground will define the data type and the Dimensions based upon your formula. This way you can very easily play with the Formula Playground and check how your Dimension modifiers impact your Block Dimensions.

When opening the formula playground from an established metric, it will retain the values of a formula result but will not show any manually input items or overrides.


Custom Structure mode


Custom structure mode allows you to define the dimensions and data type for a formula.  Using the dropdowns to the right of the mode selector, you can easily adjust the data type, as well as dimensions.  This can be used to help you troubleshoot formulas without impacting the rest of the Application.  You can also easily adjust the dimensionality to see the impact on your results. 


Formula Wizard


 The Formula Wizard guides you step by step through using the BY Modifier to create a Metric from Transactions list data. 


🎓 Explore our Academy activities to practice using the Formula Playground and the Formula Wizard

0 replies

Be the first to reply!