How To Add Date Range In Power Bi

How to add date range in Power BI

Adding a date range in Power BI can be done by utilizing Power Query Editor or by creating custom measures. Below are detailed explanations on both methods:

Method 1: Using Power Query Editor

  1. Open Power BI and load your data into Power Query Editor.
  2. Select the column that contains the date values.
  3. Go to the “Add Column” tab and click on “Date” in the “Date” section.
  4. A drop-down menu will appear. Choose “Between” to set a date range.
  5. Enter the start and end dates for your range.
  6. Click “OK” to apply the date range filtering to your data.
  7. Close the Power Query Editor and your visualizations will reflect the filtered date range.

Method 2: Creating custom measures

  1. Open Power BI and create a new measure using the “New Measure” button.
  2. Use the DAX (Data Analysis Expressions) formula language to define your custom measure. For example, you can use the following formula to display sales within a specific date range:
SalesInRange = CALCULATE(SUM(Sales[Amount]), Sales[Date] >= DATE(2021, 1, 1) && Sales[Date] <= DATE(2021, 12, 31))

In this example, Sales[Amount] represents the sales data column, and Sales[Date] represents the date column. Adjust the dates according to your desired range.

  1. Create visuals and include the custom measure to display the data within the specified date range.

By following these methods, you can add and display date ranges in Power BI with ease. Customize the date ranges based on your data and requirements.

Read more

Leave a comment