GitHub user dosubot[bot] added a comment to the discussion: Is it possible to compare chart values between two different time periods (current vs past) in a Superset dashboard?
<!-- Answer --> Hey @FrancescoCastaldi — yes, Superset **natively supports time comparison** across several chart types. Here's a breakdown addressing your questions: **1. Native time comparison support** Superset has built-in time comparison at the query level. It generates separate queries for each time offset and merges results with original data through time-grain-based joins [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/common/query_context_processor.py#L472-L621). You can display results as raw values, absolute difference, percentage change, or ratio [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/viz.py#L1082). **2. Chart types with time comparison support** - **Time-series charts** (line, bar, area) — support multiple time shifts with visual styling [[3]](https://github.com/apache/superset/pull/38473) - **Mixed Timeseries** — includes dashed lines for comparison series [[4]](https://github.com/apache/superset/pull/34794) - **Big Number with Time Period Comparison** — shows main metric, comparison metric, Δ, and % change (requires `CHART_PLUGINS_EXPERIMENTAL` feature flag, introduced in 4.1) [[5]](https://github.com/apache/superset/discussions/31883) - **Table with Time Comparison** — shows comparison columns with absolute and percentage differences (also requires the experimental flag) **3. Configuring a comparison offset** You configure offsets via the `time_compare` control in the chart's Explore view. Supported formats include [[6]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py#L56-L62): - `"1 year ago"`, `"1 month ago"`, `"1 week ago"`, `"6 months ago"` - Explicit date ranges: `"2015-01-03 : 2015-01-04"` [[7]](https://github.com/apache/superset/pull/34375) - `"inherit"` — bases comparison on the selected time range span [[8]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/common/query_context_processor.py#L485-L490) The `comparison_type` parameter lets you choose between: **values** (side by side), **difference**, **percentage**, or **ratio**. **4. Built-in controls vs custom SQL** The recommended approach is through the **built-in time comparison controls** in the chart configuration panel — no custom SQL needed. The `time_compare` field accepts an array of offsets, so you can compare against multiple past periods simultaneously [[9]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/shared/migrate_viz/query_functions.py#L243). **5. Known limitations** - **Annotations don't respect time shift** — the "Time Shift" option on annotations is present in the UI but non-functional in the backend [[10]](https://github.com/apache/superset/issues/36966) - **Visual distinction** — multiple time-shifted series can appear with similar colors/dash patterns. Uncheck "Match time shift color with original series" to get distinct colors [[11]](https://github.com/apache/superset/issues/38639) - **Table header alignment** — with multiple metrics + time comparison in table charts, headers can become misaligned [[12]](https://github.com/apache/superset/issues/36185) - **Configuration pitfall** — some users see identical values for both periods, typically due to misconfigured time ranges or grains [[13]](https://github.com/apache/superset/discussions/31507#discussioncomment-11606786). Make sure your time grain and time range are set correctly for the offset to produce meaningful differences. Hope that helps — let me know if you need more detail on any specific chart type or configuration! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=2e9536c9-bc19-4c62-95b9-a72370d749e4) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset) GitHub link: https://github.com/apache/superset/discussions/40122#discussioncomment-16920320 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
