Search code examples
datepowerbidaxslicers

PowerBI, DAX. Is there a way to set an upper limit to a slicer?


I'm trying to create some measures using DAX on an underlying data model which I would then use for creating some visuals (line chart, bar chart etc.). Each table in the data model has a data field (date&time) that contains repeated dates and times (more occurencies with the same date&time). To use the metrics in the visuals I need the measures to be grouped for date (only date, not for time).

To achieve the task I've created a calendar table (using CALENDAR in DAX) to set-up a set of dates (only dates) to which refer at for every table in the data model and created relations (dates that points to calendar date) for every table. I set the upper limit of the calendar table to be a year ahead of the max date in the dataset, because some measures need to be evaluated in the future.

In the visual pages, I put a slicer that points to the calendar table dates, but the date interval is too wide. I need the slicer to have a more narrow interval, let's say, only "for the present and the past" but I prefer not to add another calculated table.

In your opinion, is there a way to limit the slicer without changing its reference to the calendar table?

Thanks!


Solution

  • For the calendar you may just use CALENDARAUTO(). It will expand automatically as the data model expands.

    For the slicer, just select it, open the filter pane and define a filter with the upper limit you want.