How to Filter Between Two Dates in Power BI + Examples

In this tutorial, we will learn about Power BI Filter Date Between and Power BI filter between two dates.

Additionally, we will discuss the topics below:

  • Power BI filter between two dates Dax
  • How to filter between two dates in Power BI?
  • Power BI slicer between two dates
  • Power BI measure filter date range
  • Power BI filter between two relative dates

Power BI Filter Date Between

In the Power BI filter, the date between means you’re choosing a date range in Power BI. When you use “Filter Date Between,” you’re basically telling Power BI only to show data that falls within the range you specify. It’s like putting a border around the dates you want to focus on so you can easily analyze.

Let’s say you have a sales table in Power BI that covers the entire month of April data. Now, you want to see only the sales data from April 1st to April 10th. To do this, you’d use the “Filter Date Between” feature. You’d set the start date as January 1st and the end date as March 31st.

power bi filter between two date

Filter Between Two Dates in Power BI

To filter between two dates in Power BI, refer to the example below:

We have a SharePoint List (Project Schedule 2024) that contains below columns with various data types:

ColumnsData Types
Project NameSingle line of text
Start DateDate and time
End DateDate and time
power bi filter between two dates

Now follow the below steps:

1. Open Power BI Desktop and load the above SharePoint List in Power BI Desktop. Then, you can see the data presented in the Data pane.

power bi date filter between two dates

2. Under the Home tab, expand Visual gallery(black box) -> Click the Table visual.

power bi filter date between two dates

3.  Then, using the +Add data option, add the Project name, Start Date, and End Date into the Columns field.

power bi filter date between

4. To apply a filter, expand the Filter pane and choose the data field you want. In this case, I’ve selected the StartDate data field.

How to apply a filter between two date column in powerbi

5. Select “Advanced filtering” as the Filter type, and then apply the condition. For example, you can filter data between two dates. After setting the condition, click on the “Apply filter” option to implement it.

How to filter between two dates in the Power BI

6. After that, you can see it filters and displays the data in the table visually based on the condition applied.

filter between two dates in the Power BI

This is how you filter data between two dates in Power BI using the Filter Fields pane.

Power BI Filter Between Two Dates DAX

In this example we will see how we use Power BI DAX to filter between two dates.

Suppose you want to analyze sales data in Power BI for a specific time period, like between January 1st, 2024, and February 28th, 2024. Here I tell you how we can do this:

Here, we have a SharePoint list named Transactions that contains the following columns with various data types:

dax filter dates between in Power BI

Now follow the below steps:

1. Open Power BI Desktop and load the above SharePoint List in Power BI Desktop. Then, you can see the data presented in the Data pane.

Power BI dax between two dates

2. Then, in the Home tab, click “New measure.”

Power BI dax date between

3. In the formula bar, Put the below expression. Then click Commit.

Sales Between Dates = 
CALCULATE(
    SUM('Transactions'[Sales Amount]),
    FILTER(
        'Transactions',
        'Transactions'[Date] >= DATE(2024, 1, 1) &&
        'Transactions'[Date] <= DATE(2024, 2, 28)
    )
)

Where:

  • Sales Between Dates = This is the name given to the calculated measure, indicating that it calculates sales between specific dates.
  • CALCULATE() = This function is used to modify or filter the context in which other functions operate.
  • SUM(‘Transactions'[Sales Amount]) = This calculates the total sales amount by summing up the values in the “Sales Amount” column of the “Transactions” table.
  • FILTER(‘Transactions’, ‘Transactions'[Date] >= DATE(2024, 1, 1) && ‘Transactions'[Date] <= DATE(2024, 2, 28)) = This filters the “Transactions” table to only include rows where the date falls between January 1, 2024, and February 28, 2024.
Power BI dax between two values

4. Under the Home tab, expand Visual gallery(black box) -> Click the Card visual.

power bi dax filter table between two dates

5. Then, using the +Add data option, add Sales Between Dates in the Data field.

Power BI dax filter between two dates

This way, you can calculate sales between data in Power BI using DAX.

How to Filter Between Two Dates in Power BI?

In this example, we will see how to filter between two dates in Power BI using the DATESBETWEEN function.

Let’s say you want to analyze sales data between specific dates to track the performance of a recent marketing campaign that ran from January 1st to January 31st.

You have a dataset showing sales amounts for the months of January and February, as shown in the table below:

Power BI How to Filter Between Two Dates

Now follow the below steps:

1. Open Power BI Desktop and load data using the Get data option. Then, you can see data in the Data pane.

date filter power bi

2. Then, in the Home tab, click “New measure.”

Power BI dax date between

3. In the formula bar, Put the below expression. Then click Commit.

SalesInRange = CALCULATE(SUM(Sales[Amount]), DATESBETWEEN(sales[Date], DATE(2024,01,01), DATE(2024,01,31)))

Where:

  • SalesInRange = This is the name we’re giving to the calculated measure we’re creating.
  • CALCULATE = This function modifies the context in which other expressions are evaluated, often by applying conditions.
  • SUM(Sales[Amount]) = This part tells Power BI to sum up the values in the “Amount” column of the “Sales” table; it calculates the total sales amount.
  • DATESBETWEEN(sales[Date], DATE(2024,01,01), DATE(2024,01,31)) = This function filters the dates in the “Date” column of the “sales” to include only those between January 1, 2024, and January 31, 2024.
power bi date between

4. Under the Home tab, expand Visual gallery(black box) -> Click the Card visual.

power bi dax filter table between two dates

5. Then, using the +Add data option, add SalesInRange in the Data field.

How to Filter Between Two Dates in Power BI

This way, you can filter between two dates in Power BI using the DATESBETWEEN function.

Power BI Slicer Between Two Dates

Let’s see how we can apply a filter between two dates using a date slicer in Power BI.

Let’s imagine you want to analyze your sales data from January 1st, 2024, to April 30th, 2024, to understand which products are selling the most during this period and to identify any trends.

We have a dataset in the Excel file below that shows sales from January to May.

power bi slicer between two dates

Now follow the below steps:

1. Open Power BI Desktop and load data using the Get data option. Then, you can see data in the Data pane.

power bi date slicer between two dates

2. Under the Home tab, expand Visual gallery(black box) -> Click the Slicer visual.

power bi slicer between two values

3. Then, using the +Add data option, add the Date column into the Field.

power bi from to date slicer

If your slicer doesn’t resemble the one shown above, follow these steps: select the slicer, open the Format pane, expand slicer settings, and under “Style,” choose “Between.”

date slicer between power bi

4. Under the Home tab, expand Visual gallery(black box) -> Click the Stacked column chart.

Power BI slicer between filter between two dates

5. Then, using the +Add data option, add Product into the X-axis and Revenue into the Y-axis.

Filtering on multiple dates using a single date slicer in Power BI

6. After that you select January 1st, 2024, to April 30th, 2024 in the slicer.

Filtering on multiple dates using a single date slicer example

Now I hope you can see when we select January 1st, 2024, to April 30th, 2024, in the slicer, the column changed.

By following these steps, you’ll be able to use Power BI slicers to analyze your sales data between two specific dates and make informed business decisions.

Power BI Measure Filter Date Range

Imagine you want to analyze sales performance for a specific date range. For example, you might want to see the total sales amount for the past 30 days.

To do this, you have below data set:

power bi measure filter date range

Now follow the below steps:

1. Open Power BI Desktop and load data using the Get data option. Then, you can see data in the Data pane.

power bi date range filter

2. Then, in the Home tab, click “New measure.”

power bi between two dates

3. In the formula bar, Put the below expression. Then click Commit.

Last 30 days Sales Amount = 
CALCULATE(
    SUM('Transaction Records'[Sales Amount]),
    FILTER(
        'Transaction Records',
        'Transaction Records'[Sale Date] >= TODAY() - 30 && 'Transaction Records'[Sale Date] <= TODAY()
    )
)

Where:

  • Last 30 days Sales Amount = This is the name given to the result of the expression.
  • CALCULATE() = This function allows us to modify the context in which other functions are evaluated.
  • SUM(‘Transaction Records'[Sales Amount]) = This calculates the sum of the ‘Sales Amount’ column from the ‘Transaction Records’ table, giving us the total sales amount.
  • ‘Transaction Records'[Sale Date] >= TODAY() – 30 && ‘Transaction Records'[Sale Date] <= TODAY() = This function filters the ‘Transaction Records’ table only to include rows where the ‘Sale Date’ falls within the last 30 days from today.
power bi date between filter

4. Under the Home tab, expand Visual gallery(black box) -> Click the Card visual.

power bi filter between dates

5. Then, using the +Add data option, add the Last 30 days Sales Amount in the Data field.

power bi filter date range

6. If you add the Sales Amount to the slicer, you can see the total sales.

power bi date between two dates

This way, you can use Power BI to measure the filter date range.

Power BI Filter Between Two Relative Dates

Let’s say you working on sales data in Power BI. Your boss wants to see the sales performance for the past week, but they also want the flexibility to check the performance for any other week.

You can do this using the relative filter type in the Power BI filter panel.

According to our requirement, we have a SharePoint list named Sales Transactions that contains the following columns with various data types:

ColumnsData Types
Order IDNumber
Order DateDate and time
ProductSingle line of text
QuantityNumber
PriceCurrency
CustomerSingle line of text
power bi add date filter

Now follow the below steps:

1. Open Power BI Desktop and load data using the Get data option. Then, you can see data in the Data pane.

dax calculate filter date range in Power BI

2. Under the Home tab, expand Visual gallery(black box) -> Click the Table visual.

power bi if between two dates

3. Then, using the +Add data option, add the Order ID, Order Date, Product, Quantity, Price, and Customer into the Columns field.

slicer between power bi

4. Select the table visual and expand the filter pane. Click on the dropdown menu for your date field in the Filters pane. Select “Filter Type” and choose “Relative date” filtering.

power bi visuals with different dates

5. Here, we’re looking at sales from last week. To do this, choose “is in the last” from the dropdown, then type “1” in the box next to “Week.” After that, click “Apply filter.”

power bi relative date filter week start monday

6. After that you can see our visuals will now show sales data for the past week. Since today is May 8th, selecting “Last week” will display sales from May 2nd to May 8th.

power bi filter between two times

This is how to apply filters between dates using the relative filter type in Power BI.

Some more Power BI articles you may also like:

In this tutorial, we’ve learned about filtering dates in Power BI, focusing on the “between” function. We’ve explored using DAX to filter data between two specific dates, utilizing slicers to narrow down data within a date range easily. We’ve also looked at creating measures to filter data based on date ranges and explored filtering between relative dates.

  • Good day – thanks for this, I see you MVP in sharepoint, really hoping you could assist me – Going to create a list input on sharepoint – user will input a ID then start & end date and a value. In Power BI – I need to extract the data into a table showing each day (date) and the value divided by the number of days between the start and end dates.

  • >