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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How can I calculate the SUM based on criteria?

Hello

 

I want to calculate the sum of a column that contains values from Measures based on criteria.

 

I have data like:

 

Customer1, MeasureResult1

Customer1, MeasureResult2

Customer2, MeasureResult3

 

I want to calculate the sum per customer, i.e.

Customer1, (MeasureResult1 + MeasureResult2)

Customer2, MeasureResult3

 

The problem is that the MeasureResults are not available when PowerBI autocompletes formulas.

 

Any idea?

 

Thanks

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try something like the measure below:

 

 

measure = SUMX(SUMMARIZE(TABLE,TABLE[Customer],"a",[MeasureResult]),a)

 

 

It will be nice if you can show us some sample data if possible.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try something like the measure below:

 

 

measure = SUMX(SUMMARIZE(TABLE,TABLE[Customer],"a",[MeasureResult]),a)

 

 

It will be nice if you can show us some sample data if possible.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Tahreem24
Super User
Super User

@Anonymous ,

Please share some data input and expected result for better understanding.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
amitchandak
Super User
Super User

@Anonymous , Not very clear. But something like that

sumx(Summarize(Table,Table[customer], "_1",
switch( true(),
max(Table1[customer]) = "Customer 1" ,[Measure 1]+[Measure 2],
max(Table1[customer]) = "Customer 2" ,[Measure 2]
)) ,[_1])

 

Also refer if this can help

https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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