Power BI date slicer between a default to today

In this Power BI tutorial, we will see how to set a date slicer between a default to today using Power Bi Dax in Power BI. Also covered are the below-highlighted headings:

  • Power BI date slicer default range
  • Power BI date slicer default to last 30 days
  • Power BI date slicer default to yesterday
  • Power BI date slicer default to last month

Power BI date slicer between a default to today

Let us see how we can set the date slicer between a default to today in the Power Bi report.

Directly it is not possible to set the date slicer default to today in Power Bi. But we can achieve this using the Power Bi DAX formula.

To achieve this Follow the below-mentioned steps:

In this example, I have used the sales table data, to filter the data based on the date slicer visual set to today in Power Bi.

  • Initially open the Power Bi, desktop and load the data table using the get data option.
  • Click on the New Measure under the home tab and apply the below-mentioned formula:
dimDate = ADDCOLUMNS(CALENDARAUTO(3),
"year",YEAR([Date]),
"QuaterNumber", QUARTER([Date]),
"Quater", "Q"&QUARTER([Date]),
"MonthNo", MONTH([Date]),
"Month", Format([Date],"MMM"),
"Day" ,DAY([Date]),
"slicer date", if ([Date]= TODAY(),"Today",
IF( [Date]<TODAY(), [Date]&"")))

Where,

  • dimDate = Measure Name
  • ADD COLUMNS, CALENDARAUTO = Function Name
  • In the below screenshot, you can see that it displays the based on the formula applied.
Power Bi date slicer between a default to today
Power Bi date slicer between a default to today
  • Now in the report section, select the slicer visual from the visualization then drag and drop the slicer date feel from the fields pane as below:
Power Bi date slicer between a default to today example
Power Bi date slicer between a default to today’s example
  • Click on the slicer and select the ellipses icon (…) in the top right-hand corner, and in the sorting option select the Z>A option to reverse the order of the sort (it will change from A>Z to Z>A)
  • By default, the slicer visually displays the value in ascending order. To sort the slicer in descending order choose the Z-A sort option to set the date slicer default value.
  • The screenshot below displays the date slicer which has been set to default as today’s value.
Example of Power Bi date slicer between a default to today
Example of Power Bi date slicer between a default to today

This is how to set the date slicer between a default to today in the Power Bi report.

Power BI date slicer default range

Here we will see how we can set the date between the slicer default range in the Power Bi report.

In this example, we will set the default date slicer between a recent 14 days and choose the date ranges for the filtered date values.

  • Load the data into the Power Bi desktop, and then select the slicer visual from the visualization and then drag and drop the order date field as below:
Setting a default value for between date slicer
Setting a default value for between date slicer
  • Now Expand the filter pane, choose the order date filter and choose the filter type as the Relative date, and filter the date value for the last 14 days.
  • Once the condition has been applied, click on the Apply filter option.
Power BI date slicer default range example
Power BI date slicer default range example
  • The date slicer filters and displays the date value based on the condition applied.
  • In the below screenshot, you can see that the clustered column chart filters and displays the value based on the date selected in the default date slicer.
Power BI date slicer default range
Power BI date slicer default range

This is how to set the date between the slicer default range in the Power Bi report.

Power BI date slicer default to last 30 days

Let us see how we can filter the table data for the last 30 days using a default date slicer in the Power BI report.

  • Load the data into a Power Bi desktop. From the visualization select the slicer visually and drag and drop an order date field as below:
Power BI date slicer default to last 30 days
Power BI date slicer default to last 30 days
  • Now Expand the filter pane, choose the order date filter and choose the filter type as the Relative date, and filter for the 30 last days.
  • Once the condition has been applied, click on the Apply filter option.
Power BI date slicer default to last 30 days example
Power BI date slicer default to last 30 days Example
  • Based on the condition applied the date slicer filters and displays the date value.
  • when we select any of the dates from the date slicer it filters and displays the sales data value accordingly like below:
Example of Power BI date slicer default to last 30 days
Example of Power BI date slicer default to last 30 days

This is how to filter the table data for the last 30 days using a default date slicer in the Power BI report.

Power BI date slicer default to yesterday

Let us see how we can filter the table data for Yesterday’s date value using a default date slicer in Power BI.

  • Log in to the Power Bi desktop and load data into it. From the visualization select the slicer visually and drag and drop an order date field as below:
Power BI date slicer default to last 30 days
Power BI date slicer default to yesterday
  • Now Expand the filter pane, choose the order date filter and choose the filter type as the Relative date, choose the last day option, and mention a value as 1 for the previous date value.
  • Where today’s date is 21/02/2023, so the date slicer visual filters, and displays yesterday’s date value as 20/02/2023.
  • Once the condition has been applied, click on the Apply filter option.
Power BI date slicer default to yesterday
Power BI date slicer default to yesterday
  • The date slicer filters and displays the date value based on the condition applied.
  • In the below screenshot, you can see that the clustered column chart filters and displays the value based on the date selected in the default date slicer.
Power BI date slicer default to yesterday example
Power BI date slicer default to yesterday example

This is how to filter the table data for Yesterday’s date value using a default date slicer in Power BI.

Power BI date slicer default to last month

Let us see how we can filter the table data for the last month or the previous month’s data using a default date slicer in Power BI.

  • Open the Power BI desktop and load table data into it. From the visualization select the slicer visually and drag and drop an order date field as below:
Power BI date slicer default to last 30 days
Power BI date slicer default to last month
  • Now Expand the filter pane, choose the order date filter and choose the filter type as the Relative date, and choose the last month option.
  • Where today’s date is 21/02/2023, so the date, slicer visual filters, and displays the date value 30 days before today’s date.
  • Once the condition has been applied, click on the Apply filter option.
Power BI date slicer default to last month
Power BI date slicer default to last month
  • Based on the condition applied the date slicer filters and displays the date value.
  • In the below screenshot, you can see that the clustered column chart filters and displays the value based on the date slicer selection.
Power BI date slicer default to last month example
Power BI date slicer default to last month example

This is how we can filter the table data for the last month or the previous month’s data using a default date slicer in Power BI.

This Power Bi tutorial explained how to set the date slicer between a default to today in Power Bi. Also covered the below-mentioned headings:

  • Power BI date slicer default range
  • Power BI date slicer default to last 30 days
  • Power BI date slicer default to yesterday
  • Power BI date slicer default to last month

You may like the following power bi tutorials:

>