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
pedrams
Regular Visitor

Sum all Values in one column depending on Values of other column

Hi all,

 

I would like to sum the values in the column "amount" for all unique values in column "merchant-order-id" and only keep the uniqe value of "merchant-order-id" with the summed "amount".

 

I hope my question is clear. Thank you!

 

power_bi

1 ACCEPTED SOLUTION

Yes. Just add all the columns you want to keep here:

 

NewTable = SUMMARIZE(YourTable, YourTable[merchant-order-id], COLUMN1, COLUMN2, "Amount", sum(YourTable[Amount]))

 

PS.: if you think my answer solves your problem, don't forget to mark the post as solution. 🙂

Regards. 

View solution in original post

3 REPLIES 3
MarcoRotta
Resolver I
Resolver I

Hi pedrams.

 

SUMMARIZE function can do that to you. Docs and samples here: https://msdn.microsoft.com/en-us/query-bi/dax/summarize-function-dax 

 

At a glance, just go to "Modeling" and select "New Table". For your sample data it would be something like:

 

NewTable = SUMMARIZE(YourTable, YourTable[merchant-order-id], "Amount", sum(YourTable[Amount]))

 

In the formula above, "YourTable" should be changed to your current data table, which you did not mention. "New Table" could be renamed to anything you like. 

 

Regards. 

Hi Marco,

 

thank you for the solution. But I lose all the other columns, how can I keep all the other columns?

 

Best,

Pedram

Yes. Just add all the columns you want to keep here:

 

NewTable = SUMMARIZE(YourTable, YourTable[merchant-order-id], COLUMN1, COLUMN2, "Amount", sum(YourTable[Amount]))

 

PS.: if you think my answer solves your problem, don't forget to mark the post as solution. 🙂

Regards. 

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.