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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

sum ignores my negative values

Lisborgen_0-1598885427498.png

Hi,

i want to sum my stock grouped by the product_id --> see column sum_stock. How come my negative values are beeing ignored using this formula? the result of the column should be zero, not 76.

 

Greatful for any help an this!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Extremely difficult to say without sample source data. Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous 

Due to I don't know your data model, I build a sample to have a test.

1.png

I build a calculated column and a Measure like yours.

 

C_Sum Stock = CALCULATE(SUM('Table'[STOCK]),ALLEXCEPT('Table','Table'[Material_SAP.1.C_ProdKeyInID]))
M_Sum Stock = CALCULATE(SUM('Table'[STOCK]),ALLEXCEPT('Table','Table'[Material_SAP.1.C_ProdKeyInID]))

 

Both of them return to the correct result 0 .

2.png 

I think your problem may be caused by your data model. 

Allexcept function will remove all filters except the filter in Material_SAP.1.C_ProdKeyInID column. And blog below is helpful, they may help you to understand ALl functions in Dax.

Blog: All Function Allexcept Function Allselected Function  Managing-all-functions-in-dax 

If this reply still couldn't help you to solve your problem, please show me more details about your data model.

Or you can share your pbix file with me by your Onedrive for Business.

 

Best Regards,

Rico Zhou

 

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

 

Greg_Deckler
Community Champion
Community Champion

@Anonymous - Extremely difficult to say without sample source data. Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors