Hi, We're trying to calculate the MAT (Moving Annu...
# gooddata-cloud
a
Hi, We're trying to calculate the MAT (Moving Annual Total, the sum of the previous 52 weeks). We're using rolling windows, similarly to YTD (https://www.gooddata.com/docs/cloud/create-metrics/maql/runing-totals/rolling-window/) but we've run into an issue. If we only give the client access to a certain date range, eg year 2024 (hidden filter on the entire visualisation), we still want to give them the MAT as a benchmark on what happened in the previous year (2023) and whether they are doing better or worse. However, there aren't 52 rows to sum in that case and it gives the same number as the YTD. How can we fix this? Is there any better way to calculate it?
k
The knowledge sources do not describe a way to make a rolling-window metric “see” data that is outside of the filters applied to the visualization or dashboard. All MAQL computations, including running totals and rolling windows, are evaluated only on the rows that pass the active filters. [Running totals; Filter expressions] Because of that: • Your MAT metric (for example, something like
SELECT RUNSUM({metric}) ROWS BETWEEN 52 PRECEDING AND 1 PRECEDING
) will only have as many rows available as the filtered dataset provides. [Rolling window] • If the dashboard/visualization (or a hidden filter) restricts the date range to 2024, the engine cannot access 2023 rows, so the “52 weeks” window collapses to “all rows in 2024 so far”, which is why it effectively behaves like YTD. From the available documentation: • There is no MAQL keyword that bypasses parent filters for the underlying rows of a running total / rolling window.
WITHOUT PARENT FILTER
exists, but it still operates within the filtered dataset; it only controls which parent filters are applied, not access to data outside the final filter context. [Overriding parent filters; PARENT keywords] • Similarly, there is no documented way to say “ignore the dashboard’s date filter for this metric, but still show the result on the same dashboard” in a way that would let the MAT metric read 2023 rows while the rest of the visualization is limited to 2024. Given these constraints, the knowledge sources only suggest general patterns/workarounds in similar situations: • Adjust the data / filters so that the needed history is actually present in the filtered dataset (for example, not restricting the date filter so tightly, or loading extra rows such as zeros to cover missing periods). [Rolling window; Slack – missing previous period] • Or accept that when the client is technically restricted to 2024 data, MAT that depends on 2023 cannot be computed correctly and will effectively degrade to a partial-period metric. So, within the documented capabilities: • There is no better MAQL-only way to compute a true 52‑week MAT when the dashboard/visualization filters exclude those prior weeks. • To get a correct MAT benchmark, you would need to either: ◦ Relax the date restriction so that the MAT metric can see at least 52 weeks of history, or ◦ Precompute MAT (or store historical aggregates) outside GoodData and expose them as facts that do not depend on the current date filter. The documentation does not provide a more precise or alternative pattern for your use case beyond these general limitations. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups. 👀 Our Support team monitors all messages and will jump in if needed.
s
Hi Anouk, we have reviewed the response from our AI Assistant and can confirm that the feedback aligns with the rolling-window metric capabilities. But please feel free to follow up if you need any further assistance.
Hi Anouk. We’re just wondering if you've had a chance to review the latest update from us regarding your request? We've provided an update some time ago but we haven't heard back from you.