Power BI – Date Slicer with Default Selection

Magic of the new Power BI Button Slicer: the current calendar month is always selected by default.

In the video, I change the system date, refresh the report, and the slicer selection updates automatically to reflect the new current month.

Solution

Use this Date table https://github.com/avatorl/M/blob/master/DateTable.m, or add an Offset Months column to your existing date table.

// Add offset for this month (-1 = previous, 0 = current, 1 = next)
AddOffsetMonth = Table.AddColumn(AddFiscalMonthNumber, "Offset Months", each ([Year] * 12 + [Month Number]) - (Date.Year(_Today) * 12 + Date.Month(_Today)), Int64.Type),

Add a Button Slicer and drop the Offset Month column into the slicer.

Select the button with the “0” value (0 means this month, 1 means next month, -1 means the previous month, and so on). Now, the current calendar month is the default selection.

In the Format Pane:

  • Under Callout Values, disable Values. This will hide the Offset Month values from the slicer.
  • Enable Label, and drop the Month Short column into the Label field. This will add month names to the slicer.

Add a filter by Date column to include only this year into the slicer.

Feel free to use a different filter and a column other than Month Short for the button labels.

The solution will work with current week or current date as well.

Enjoy the new slicer!

See the attached PBIX file:

Share the article