How to Show Last 7 Days Data in Power BI

Cody Schneider••8 min read

Filtering your Power BI report to display just the last 7 days of data is one of the most common and useful tasks for creating timely, relevant dashboards. This focus on recent activity helps you monitor short-term trends, track daily campaign performance, and make quick, informed decisions. This tutorial will walk you through four distinct methods to achieve this, from simple UI clicks to powerful DAX formulas and Power Query transformations.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why a Dedicated Date Table is Your Best Friend

Before we jump into the specific techniques, let's talk about a Power BI best practice: the date table. A date table (or calendar table) is a separate table in your data model that contains a continuous list of dates and associated information like year, quarter, month, and day of the week.

While you can sometimes filter using the date columns in your main data tables (like a 'Sales' or 'Traffic' table), using a dedicated date table makes time intelligence functions more reliable and your model more efficient. If you don't have one, you can create one easily in Power BI Desktop.

Quickly Creating a Date Table with DAX

If you don't have a date table yet, here’s how to create a basic one using a DAX calculated table. Navigate to the Data view in Power BI Desktop, go to the "Table tools" ribbon, and click "New table." Enter this formula:

Date Table = CALENDARAUTO()

This simple function scans your entire data model for dates and automatically creates a table that covers the full range of those dates. After creating it, make sure to go to the Model view and create a relationship between your new date table's 'Date' column and the primary date column in your main data table (e.g., 'Orders'[OrderDate]).

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Method 1: The Relative Date Filter (Easiest Method)

The simplest way to filter for the last 7 days is by using the built-in relative date filter. This approach is perfect for interactive dashboards where you or your end-users can easily see and understand the active filter.

Here’s how to set it up step-by-step:

  1. Select a Visual: Click on the chart, table, or other visual you want to filter.
  2. Open the Filters Pane: Make sure the Filters pane is visible. If not, go to the "View" tab and check the box for "Filters."
  3. Drag in Your Date Field: From your date table, drag the main date column into the "Filters on this visual" well.
  4. Change Filter Type: Click the "Filter type" dropdown and select "Relative date."
  5. Configure the Filter:
  6. Choose Whether to Include Today: You’ll see a checkbox for "Include today." If checked, the filter period will be TODAY() - 6 days to TODAY(). If unchecked, it will be TODAY() - 7 days to YESTERDAY(). Choose the option that best fits your business logic.

That's it! Your visual will now exclusively show data from the last 7 days. You can also apply this filter to an entire page or the entire report by dragging the date field into the "Filters on this page" or "Filters on all pages" sections of the Filters pane.

Method 2: DAX Calculated Column for a Permanent Flag

Sometimes, you need a way to permanently "flag" rows that fall within the last 7 days. A calculated column is useful for this, especially if you want to use the flag in a slicer or apply specific conditional formatting to rows in a table.

Here's how to create the DAX calculated column:

  1. Navigate to Your Date Table: In the Data view, select your date table.
  2. Create a New Column: From the "Table tools" ribbon, click "New column."
  3. Enter the DAX Formula: Type the following formula into the formula bar. This will return a "True" or "False" value for each date:

Is in Last 7 Days = ( ‘Date Table’[Date] > TODAY() - 7 ) && ( ‘Date Table’[Date] <= TODAY() )

This formula checks each date in your Date Table and returns TRUE if that date is both greater than 7 days ago and less than or equal to today. Now you can use this Is in Last 7 Days column just like any other field in your model.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

How to use this new column:

  • As an On-Screen Slicer: Drag the Is in Last 7 Days field onto your report canvas and turn it into a slicer. Users can now easily toggle between data for the last 7 days (TRUE) and all other data (FALSE).
  • As a Background Filter: Drag the Is in Last 7 Days into the Filters pane (for a specific visual or an entire page) and set its value to TRUE.

Important Consideration: Calculated columns are only computed when your dataset is refreshed. This means the date logic (based on TODAY()) is static between refreshes. If you refresh your data once a day in the morning, this works perfectly. However, if a user opens the report in the evening, the logic will still be based on the "today" from that morning's refresh.

Method 3: DAX Measure for Laser-Focused Calculations

A DAX measure is the most flexible and performant way to calculate a value specifically for the last 7 days without filtering your entire visual. With this method, you can show a KPI for "Total Sales" right next to another KPI for "Sales Last 7 Days." This provides powerful contextual analysis.

Step 1: Create a Base Measure

First, ensure you have a base measure for the value you want to analyze. If you don’t already have one, create it. For example:

Total Revenue = SUM ( 'Sales'[Revenue] )

Step 2: Create the Time-Specific Measure

Now, create a new measure that utilizes your base measure but applies the 7-day time filter.

Revenue Last 7 Days = CALCULATE ( [Total Revenue], DATESINPERIOD ( 'Date Table'[Date], TODAY(), -7, DAY ) )

Let's break down that formula:

  • CALCULATE: The most powerful function in DAX. It modifies the filter context of a calculation. We're telling it to calculate [Total Revenue] but with a special date filter.
  • DATESINPERIOD: A time intelligence function that returns a table containing a column of dates.

You can now use this [Revenue Last 7 Days] measure in a Card visual to show a key metric, or place it in a table to see the L7D value alongside other values like "Revenue MTD" (Month-to-Date).

Method 4: Filter in Power Query Before Loading Data

What if your dataset is massive and you only ever need to report on recent data? Loading years of historical sales data can slow down your report refresh and performance unnecessarily. In this case, you can filter the data out in Power Query before it even loads into your Power BI model.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Here’s how to do it:

  1. Open Power Query: From Power BI Desktop, click on "Transform data" in the Home ribbon to launch the Power Query Editor.
  2. Select Your Query: In the left-hand Queries pane, select the table you want to filter.
  3. Find the Date Column: Locate the main date column that you want to filter on (e.g., 'OrderDate').
  4. Apply the Date/Time Filter:

This creates a dynamic filter within Power Query. Now, every single time you refresh your data, Power Query will automatically grab only the rows that fall within the previous 7 days from the data source. The older data is never even loaded into your Power BI (.pbix) file.

Warning: This is a permanent decision for your report. The historical data beyond 7 days will not EXIST in your model, so you cannot use it for year-over-year comparisons or any other long-term trend analysis.

Which Method Should You Choose?

  • Use the Relative Date Filter: An interactive, user-friendly experience on the report page. This is the go-to choice for most standard dashboards.
  • Use a DAX Calculated Column: For when you need a static 'flag' for a slicer or row-level logic and are fine with it only updating on a full data model refresh.
  • Use a DAX Measure: When you want to calculate a specific metric (like "Revenue Last 7 Days") without filtering other visuals on the page. Best for performant and flexible metric calculations.
  • Use a Power Query Filter: When you want to minimize your data model size and will only ever need the last 7 days of data in your entire report.

Final Thoughts

Whether you're using simple relative date filters, powerful DAX measures, or efficient Power Query transformations, you now have a full toolset to accurately show the last 7 days of data in Power BI. Each method serves a different purpose, and knowing which one to use in which situation will make your reporting faster, smarter, and more effective.

While mastering these Power BI techniques is powerful, the setup and learning curve can slow down the speed of getting insights. We created Graphed because we believe analyzing your marketing and sales data shouldn't require complex DAX formulas or clicking through dozens of menus. You can connect your data sources, and simply ask, "Show me my sales over the last 7 days compared to the previous period," and instantly get an interactive chart. This lets you focus more on the "what" and "why" behind your data, not just the "how" of building the report.

Related Articles