Stacked vertical bar chart

This topic contains an example of a stacked vertical bar chart.

This example uses an Analytics statement with two GROUP BY statements. One metric is summarized by a specified categorization, and the second GROUP BY is specified as the cross tab.

RETURN RegionalMargin AS SELECT 
    SUM("Gross ($)" * "Margin (%)") / SUM("Gross ($)") AS "DollarWeightedAvgMargin"
GROUP BY "Regions", "Demographics"

The stacked vertical bar chart below summarizes the “DollarWeightedAvgMargin” metric for each Region (which is the first GROUP BY and therefore the primary category) and presents a cross-tabulation with each Demographic (which is the second GROUP BY and therefore the cross tab):