Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Group by week

I have a date column and week column. I am trying to group the dates in the date column by week. I have the week as 2025_12 .... Any suggestions please?
  • Chewdata's avatar
    1 year ago

    Hey,

    Hopefully this will answer you question, if not as lbendlin suggested, please provide more informatie on what you are trying to achieve.

    In Power Query you can right-click on de column you want to group your data on that column:

    when you click on Group By, you get a new screen. Click on advanced to add multiple aggregations:
    all Rows wil give you a nested table with all rows in it.

     

  • rohit1991's avatar
    1 year ago

    Hi Anonymous ,
    If you're trying to group your data by week using a column like "2025_12" (which represents year and week), you’re already halfway there. Since your dataset has a properly formatted Week column, you can use it to group your data in visuals or through DAX. This is particularly useful when you want to aggregate values such as sales, transactions, or counts on a weekly basis. Power BI visuals like bar charts or tables will automatically group by the Week column if you add it to the axis or rows. However, if you want to create a summarized table in DAX that shows one row per week with totals or averages, you can use the SUMMARIZE function to group and aggregate based on the Week column.

     

    WeeklySummary =
    SUMMARIZE(
        YourTable,
        YourTable[Week],                         -- Group by Week column (e.g., "2025_12")
        "Total Sales", SUM(YourTable[Sales]),    -- Example metric
        "Total Quantity", SUM(YourTable[Quantity])  -- Add more measures as needed
    )