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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mb0307
Responsive Resident
Responsive Resident

Summarize table based on two coulmns and sum sales

Hi

 

Let's say I have this table:

 

ProductMonthSales
P1Jan-20100
P1Jan-20200
P2Jan-20500
P2Feb-20600
P1Mar-2050
P2Mar-20300

 

 

I want to create a NEW TABLE with summarized result like this:

 

ProductMonthSales
P1Jan-20300
P1Mar-2050
P2Jan-20500
P2Feb-20600
P2Mar-20300

 

Your help will be much appreciated.

 

Thanks.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@mb0307 ,  not sure on the need for a new table.

 

New table =summarize(Table, Table[Product],Table[Month],"Sales" ,sum(table[Sales]))

 

You can use measure sum(table[Sales]) on any visual with Product and Month  and you will get this (Table or Matrix )

View solution in original post

Greg_Deckler
Super User
Super User

@mb0307 -

Perhaps:

New Table = SUMMARIZE('Table',[Product],[Month],"Sales",SUM('Table'[Sales]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@mb0307 -

Perhaps:

New Table = SUMMARIZE('Table',[Product],[Month],"Sales",SUM('Table'[Sales]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@mb0307 ,  not sure on the need for a new table.

 

New table =summarize(Table, Table[Product],Table[Month],"Sales" ,sum(table[Sales]))

 

You can use measure sum(table[Sales]) on any visual with Product and Month  and you will get this (Table or Matrix )

@amitchandak  Thanks and this works perfectly.  

 

Is it possible to sum the SALEAS based on a filter within same DAX please? 

 

For example:  If i have a measure which is calculating a Max Week for each month (Jan max week is WK5, Feb is WK9),  Can I use that measure to filter the new table?   So Jan-20 ignore WK1,2,3,4 and only sum values by WK5 values?

 

Thanks  

@mb0307 - Sounds like you would need something like:

 

New Table = SUMMARIZE(FILTER('Table','Table'[Week] = [Max Week Measure]),'Table'[Product],'Table'[Month],"Sales",SUM('Table'[Sales]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I will post my query in a new post with an example.

 

Thanks for the reply.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.