Overriding Visualization Attributes with BY Keyword

In general, metrics determine what data the visualization computes and displays.

However, visualizations may have any number of filters and attributes that further determine how data is computed. Metrics are thus contextually impacted by the characteristics of the visualizations in which they reside.

At times, it may be useful to define a metric in a way that determines how the metric will be affected by these contextual visualization’s characteristics. This is where MAQL’s BY keywords for overriding visualization attributes come into play.

For example, you could use a MAQL BY keyword to keep a metric from being affected by visualization filters, or to override visualization attributes. You can also use the BY keyword to set an aggregation floor. Even if the attributes of a certain visualization would serve to break a metric down by a smaller grain, BY keywords can keep the metric values aggregated at a higher level.

MAQL keywords are added to metric syntax in the following order:

  • BY clauses
  • WHERE clauses
  • WITHOUT clauses.

Note that the order of MAQL keywords is alphabetical.

Review the following sections to learn about BY keywords for overriding visualization attributes: