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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
IncursioML1
Helper I
Helper I

SUMX with ALLEXCEPT not working?

 

Hi All

 

In the below I added a column with the DAX logic trying to sum up all quantities relating to a specific RelatedOrderText but getting an odd value on the newly created column.  The math is adding up to 349 where if you sum up the quantities it's adding up to 53.  What am I missing here? Is there a sort I should do first?  

 

 

NonZeroBalance = SUMX(CALCULATETABLE(VALUES(Sheet1[Quantity]),ALLEXCEPT(Sheet1,Sheet1[RelatedOrderNumberText])),Sheet1[Quantity]) 

 

 

RelatedOrderNumberTextQuantityNonZeroBalance
-12494281-20349
-12494281-214349
-12494281-321349
-12494281-135349
-12494281-270349
-12494281-270349
-12494281-405349
-12494281-26349
-12494281-26349
-124942811740349

 

IncursioML1_1-1650288417681.png

 

 

 

 

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

3 REPLIES 3
SpartaBI
Community Champion
Community Champion

@IncursioML1 

SpartaBI_0-1650293463835.png
Hope this helps 

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but in my opionion, the difference between the expectation and the result is because of the duplicated values. There are two -270s and two -26s.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Ah so the math is 

270+26+53(the correct balance) = 349.

How do I actually write the DAX to just sum up all quantities based on the related order text regardless of the quantities?

 

Below is the expectation.

 

RelatedOrderNumberTextQuantityNonZeroBalance
-12494281-2053
-12494281-21453
-12494281-32153
-12494281-13553
-12494281-27053
-12494281-27053
-12494281-40553
-12494281-2653
-12494281-2653
-12494281174053

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.