Hi Everyone, is there a reason I'm unable to apply...
# gd-beginners
j
Hi Everyone, is there a reason I'm unable to apply add a relative time filter on the metric, while it's possible to do so on the report filters? See below. Thanks
m
Hi Justin, Thank you for your question about applying relative period filters. We appreciate your observation. In GoodData, date filters, including relative period filters, are designed to be applied to date attributes (e.g., your 'Date' dimension), not directly to metrics. Metrics define what is being calculated (e.g., sum of sales, average sessions), while date attributes define over what period that calculation should occur. Therefore, when you want to apply a relative period like "last 15 days" or "this year," you apply it to the relevant date attribute associated with your data: • As an Insight Filter: You can drag your date attribute into the "Date" section (typically in the bottom-left pane) of the Analytical Designer when building your insight, and then select the desired relative period. • As a Dashboard Filter: For broader application, you set up a date filter component on your dashboard, connected to the appropriate date attribute. Any compatible insights on that dashboard will then respond to this relative period selection. This design ensures that your metrics calculate values correctly based on their definition, and then these values are dynamically sliced and viewed across different periods as defined by your date attribute filters. An option to 'apply' a relative period filter directly to a metric/fact is by MAQL, for example, between the last 30 days:
SELECT SUM({fact/TotalAmount}) WHERE ({label/SaleDate.day} > THIS(DAY,-31) and {label/SaleDate.day} < THIS(DAY,0))
We hope this clarifies why the filter behavior differs between metrics and date attributes within the Analytical Designer.