To group a table by date in Power BI, you can either use the automatic Date Hierarchy in the Report view for quick visual grouping or use the "Group By" feature in Power Query for permanent data transformation. The fastest way is to drag a date field into a visual; Power BI automatically groups it into Year, Quarter, Month, and Day.

What You'll Need

  • Power BI Desktop installed on your computer.
  • A dataset imported into Power BI that contains at least one column formatted as a Date or Date/Time data type.

Step-by-Step

Depending on whether you want to change how the data looks in a report or how the data is structured in your model, choose one of the two methods below. Note that menu labels may differ slightly based on your version of Power BI Desktop.

Method 1: Grouping via Date Hierarchies (Visual Level)

Use this method if you want to keep your raw data intact but want the report viewer to be able to drill down from years to months.

  1. Open your Power BI report and select the Table or Matrix visual from the Visualizations pane.
  2. Locate your date column in the Data pane.
  3. Drag the date column into the Columns or Rows field well of the visual.
  4. If "Auto date/time" is enabled in settings, Power BI will automatically create a hierarchy (Year, Quarter, Month, Day).
  5. To change the grouping level, right-click the date field in the field well and select either Date Hierarchy (for grouped levels) or the name of the column (for the raw, ungrouped date).
  6. Use the drill-down arrows (the double-down arrow icon) at the top of the visual to move from Year grouping down to Month or Day grouping.

Method 2: Grouping via Power Query (Data Level)

Use this method if you want to permanently aggregate your data (e.g., summing total sales per day) and remove the individual transaction rows.

  1. Click Transform Data on the Home ribbon to open the Power Query Editor.
  2. Select the date column you wish to group by.
  3. If your date column includes timestamps (Date/Time), right-click the column header, select Change Type, and choose Date. This ensures rows with the same day but different times are grouped together.
  4. Go to the Transform tab in the top ribbon and click Group By.
  5. In the Group By window, ensure Basic is selected.
  6. Under the "Group by" dropdown, select your date column.
  7. In the "New column name" box, give your aggregated column a name (e.g., "Total Sales").
  8. Under "Operation," choose the calculation you need, such as Sum, Average, or Count Rows.
  9. Under "Column," select the numerical column you want to aggregate.
  10. Click OK, then click Close & Apply on the Home ribbon to save the changes to your report.

Common Mistakes

  • Ignoring Data Types: Trying to group a date column that is formatted as "Text." Power BI cannot group or create hierarchies for text strings; the column must be set to the Date or Date/Time data type.
  • Grouping Date/Time: Grouping by a column that includes seconds and milliseconds. Because almost every timestamp is unique, the "Group By" function will not merge any rows unless you first change the type to "Date."
  • Over-aggregating in Power Query: Using the Power Query "Group By" method when you still need to see individual transaction details. Once you group in Power Query, the original granular rows are removed from the model.

Tips

  • Create a Calendar Table: For professional reports, instead of relying on Auto date/time, create a dedicated Date Table using DAX (e.g., CALENDARAUTO()). This allows for more flexible grouping, such as by Fiscal Year or Week Number.
  • Use the Matrix Visual: When grouping by date, the Matrix visual is often superior to the Table visual because it allows you to expand and collapse date hierarchies (Year > Month > Day) in a clean, nested format.
  • Custom Sorts: If your months are sorting alphabetically (April, August, December) instead of chronologically, select the Month column, go to the Column Tools tab, and select Sort by Column, then choose the Month Number column.

Troubleshooting

If your date grouping is not working as expected, try these steps in order:

  1. Check the Data Type: Go to the Data view and ensure the icon next to the column name is a small calendar. If it is "abc," change the data type to Date in the column tools.
  2. Verify Auto Date/Time Settings: If the hierarchy doesn't appear automatically, go to File > Options and settings > Options > Current File > Data Load and ensure "Auto date/time" is checked.
  3. Clear Visual Filters: If you see missing dates after grouping, check the Filters pane to ensure no specific date ranges are being excluded.
  4. Refresh the Data: If you made changes in Power Query but the table visual isn't updating, click the Refresh button on the Home ribbon.

Frequently Asked Questions

Can I group by week in Power BI?

Power BI does not have a default "Week" level in the auto-hierarchy. To do this, go to Power Query, select your date column, go to Add Column > Date > Week > Start of Week. You can then group by this new column.

Why is my date grouping showing "Year" but not "Month"?

This usually happens if the column is not recognized as a date or if the Date Hierarchy has been partially removed from the visual's field well. Drag the date field back into the visual and ensure "Date Hierarchy" is selected.

Does grouping by date slow down my report?

Grouping in the visual layer (Hierarchies) has a negligible impact on performance. However, grouping in Power Query can actually speed up your report because it reduces the total number of rows the model has to load into memory.

How do I group by a custom fiscal year?

You cannot do this with the default auto-hierarchy. You must create a custom Date Table (Calendar Table) using DAX or Power Query and add a "Fiscal Year" column, then use that column for your grouping.

Can I group by multiple date columns at once?

Yes. In a Matrix visual, you can drag multiple date columns (e.g., "Order Date" and "Ship Date") into the Rows section to create a multi-layered grouping structure.