Create a relative time slicer and filter in Power BI
APPLIES TO: Power BI Desktop Power BI service
With emerging fast refresh scenarios, the ability to filter to a smaller window of time can be useful. By using the relative time slicer or relative time filter, you can apply time-based filters to any date or time column in your data model. For example, you can use the relative time slicer to show only video views within the last minute or hour.
You don't have to use the relative time feature in conjunction with the automatic page refresh feature. However, many relative time scenarios pair well with the automatic page refresh feature.
When you apply a relative time filter or slicer at the page or report level, all visuals on that page or report are filtered to the exact same time range by using a shared anchor time. Because visuals might have slightly different execution times, this shared anchor time ensures that visuals are synchronized across your page or across your report. For more information, see anchor time.
Create a relative time slicer or filter
After you've enabled the feature, you can drag and drop the date or time field to the field well of a slicer or to the drop zone in the Filters pane.
Create a slicer
Drag a date or time field to the canvas.
Select the Slicer visualization type.
Create a filter
- Drag a date or time field to the Filters pane, in the Filters on this visual, Filters on this page, or Filters on all pages section.
Set relative time
Select the slicer, and in the Format pane, under Visual > Slicer settings > Options, change the Style to Relative Time.
Here’s how it looks in a slicer:
Here’s how it looks in a filter card:
With this new filter type, you can filter based on a time period of Last, Next, or This:
You specify the time window using a whole number and a unit of time: Minutes or Hours.
If you need to save space on the canvas, you can also create the relative time filter as a filter card in the Filters pane.
Understanding anchor time
When a filter is applied to the page or report level, all visuals on that page or report are synchronized to the same exact time range. These queries are all issued relative to a time called the anchor time. The anchor time automatically refreshes in the following conditions:
- Initial page load.
- Manual refresh.
- Automatic or change detection page refresh.
- A change to the model.
Anchor time exceptions
- Relative time filtering using the Q&A visual isn't relative to this anchor time, until you convert the Q&A visual to a standard visual. However, the other AI visuals, such as key influencers and the decomposition tree, are synchronized with the anchor time.
- Additionally, relative date filters or slicers aren't relative to the anchor time unless in the presence of relative time filters. If a relative date and a relative time filter are on the same page, the relative date filter respects the anchor time.
Considerations and limitations
The following considerations and limitations currently apply to the relative time slicer and filter.
Time zone considerations: Data models in Power BI don't include time zone info. The models can store times, but there's no indication of the time zone they're in. The slicer and filter are always based on the time in Coordinated Universal Time (UTC). If you set up a filter in a report and send it to a colleague in a different time zone, you both see the same data. Unless you or your colleague are in the same UTC time zone, you both must account for the time offset you’ll experience. Use the Query Editor to convert data captured in a local time zone to UTC.
This new filter type is supported in Power BI Desktop, the Power BI service, Power BI Embedded, and the Power BI mobile apps. However, it isn't supported for Publish to web.
Query caching: We use the client cache. Say you specify "last 1 minute," then "last 5 minutes," then back to "last 1 minute." At that point, you see the same results as when it was first run unless you refresh the page or the page automatically refreshes.