Search code examples
apache-superset

How do I create a chart in Apache Superset that contains both the raw data and a rolling average?


How do I create a chart in Apache Superset that displays both raw data (line or bar) and a rolling average (line)?

I can figure out how to do this with legacy chart options (Line Chart/ Dual Line Chart/ Multiple Line Charts) but they are labelled Legacy or Deprecated. The new option seems to be Mixed Time-Series, but it doesn't look like this supports rolling averages.


Solution

  • This is possible in Superset v2.0.0. Select the chart template Mixed Chart, then complete the fields on the DATA tab: Shared query fields, Query A, Advanced Analytics Query A, Query B, Advanced Analytics Query B.

    On one of the Advanced Analytics sections, specify mean for the ROLLING FUNCTION and values (probably the same) for PERIODS and MIN PERIODS.

    Then on the CUSTOMIZE tab, select the SERIES TYPE for A and for B. That lets you mix bars and lines.

    And you should get a chart like this: enter image description here