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?

  • 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.

     

  • 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
    )
    

6 Replies

  • Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

  • Chewdata's avatar
    Chewdata
    Responsive Resident

    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.

     

  • 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
    )
    
  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hello Anonymous 

    Could you please confirm if your query have been resolved the solution provided by rohit1991 & Chewdata ? If not please share the details so that we can assist you better. If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

    Thank you

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    HI Anonymous 

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

    Thank you.

     

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi Anonymous 
    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

    Thank you.