Validate Formula

LLM-friendly URL
POST
https://api.luzmo.com/0.1.0/formula
API call form
Examples
List of examples
  • Calculate a ratio of distinct counts with COUNTD
  • Calculate a score from conditional counts with IF, COUNT, and COUNTR
  • Compare group averages with the overall average using GROUPFULL
  • Compare averages with a broader group using GROUPINEX
  • Average per-entity totals with nested SUM, GROUPINEX, and AVG
Description

Compare each group's average with a shared benchmark across all chart dimensions. GROUPFULL removes those dimensions from the benchmark calculation while keeping filters applied. Use this pattern to compare groups with the overall average.

Example use-case

Compare employee groups with a shared company benchmark to see which groups have average salaries above or below the overall average.

Source data: The employees dataset contains one row per employee, with salary and gender columns.

How the calculation works

Formula : AVG(salary) / GROUPFULL(AVG(salary))

  1. Calculate the group average: AVG(salary) averages salaries within the current chart group.

  2. Calculate the benchmark: GROUPFULL(AVG(salary)) averages salaries without the chart's grouping dimensions. Filters still apply to both averages.

  3. Compare the averages: Divide the group average by the benchmark. A ratio of 1 means the averages match. Enable percentage formatting on the chart to display the ratio as a percentage.

Example result: With chart percentage formatting, 1.1 displays as 110% , meaning the group's average salary is 10% above the filtered company average.

Usage
  • Measure: In a column chart grouped by gender, shows each gender's average relative to the filtered company average. Enable percentage formatting on the measure.

  • Having filter: Keep gender groups above the company average using formula > 1 . The threshold uses the raw ratio.

Install
npm install @luzmo/nodejs-sdk
Example Response
200
400
500
{
  "type": "numeric",
  "valid": true
}