Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AMar22
Frequent Visitor

Groupeby two columns

Dears,

 

I have a table where I insert the sales per week (table 1), I want to create a new table from this table to group the sales per week while keeping the month column (table 2)

GroupeBy 02 columns.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AMar22 ,

Please try:

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[Month],
    'Table'[week],
    "Total Sales", SUM ( 'Table'[Sales] )
)

vcgaomsft_0-1666937475877.png

For the [Month] column, you can create calculated columns like:

Month 2 = FORMAT('Table'[Date],"mmm"&"."&"-"&"yy")

vcgaomsft_1-1666937687888.png

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

4 REPLIES 4
ced_f
Frequent Visitor

Hi, 

If you want to get Month from Date, you can use something like below

 

Table2 =
    SUMMARIZE (
        ADDCOLUMNS ( Table1, "Month", EOMONTH ( Table1[Date], -1 ) + 1 ),
        [Month],
        Table1[week],
        "TotalSales", SUM ( Table1[Sales] )
    )

 

In general for something like that, having a Calendar table is a better approach except if you are not on a complex model. 

 

Regards
Cedric

rsbin
Super User
Super User

@AMar22 ,

Create a new Table using the following:

Table2 = SUMMARIZECOLUMNS( Table1[Month], Table1[Week],
                               "TotalSales", SUM(Table1[Sales] ))

This should get you what you asked for.

Regards,

AMar22
Frequent Visitor

Hi @rsbin , thanks for you response

 

But that is not what I am asking.

the result of your proposition gives this

GroupBy 2columns 2.JPG

 

I am asking the sum of sales per week whith keeping the "Month" column.

Anonymous
Not applicable

Hi @AMar22 ,

Please try:

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[Month],
    'Table'[week],
    "Total Sales", SUM ( 'Table'[Sales] )
)

vcgaomsft_0-1666937475877.png

For the [Month] column, you can create calculated columns like:

Month 2 = FORMAT('Table'[Date],"mmm"&"."&"-"&"yy")

vcgaomsft_1-1666937687888.png

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.