@groups

Defines a list of hierarchical columns to group along the primary axis

-- @groups: Month, Product

Valid Types

List

A comma separated list of columns to use as categories

Full Example

-- @chart: bar
-- @title: Groups - Multiple category groups
-- @subtitle: An example of multiple category groups
-- @groups: Channel, Owner
-- @series: TotalSales
-- @formats: currency
SELECT 
	Final.*
FROM (  
  SELECT 
  	Channel,    
  	Owner,
    (
      SELECT sum(Sub.Amount)
      FROM Sales Sub
      WHERE Sub.Channel = Sales.Channel
    ) as TotalChannelSales,
    sum(Amount) as TotalSales
  FROM Sales
  WHERE Owner IN (
    SELECT Owner
    FROM Sales
    GROUP BY Owner
    ORDER BY sum(Amount)
    LIMIT 10
  )
  GROUP BY Channel, Owner
) as Final
ORDER BY TotalChannelSales ASC, TotalSales ASC

Use Cases

Use groups to heirarchically group series columns together when you want to make visually distinct buckets. In the example above, without the @groups parameter, the chart would render without separating the parent category.

Last updated

Support

DiscordX

ChartSQL