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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

SUMX wrong totals

HI

when I export data, totals are different to what i am getting in Power bi dashboard

please help me with the following problem.

I have customer, material , segmant, sales, quantitiy all the fields in one sales table

I want to calculate price variance 

(current year sales/ quantity -previous year sales/quantity) * current year quantitiy. but able to see with all the attributes.. 

if there are no sales for current or previous year on a particular material it has to be 0 otherwise above formula.

 

below

 

Price Variance =
if([Sales per Unit_CY]=0 || [Sales per Unit_PY]=0,0,
 
   CALCULATE(SUMX(VALUES(ATC[material]),[Sales_Per_unit_var]*[Quantity_CY]),ALLSELECTED(ATC[customer])))

 

6 REPLIES 6
Anonymous
Not applicable

they are not helpful, its simple by totals not adding up . I think its context transition issue. 

giri41_0-1711213582664.png

values are correct , but total of correct values not correct .

 

 

if([Sales per Unit_CY]=0 || [Sales per Unit_PY]=0,0,
 
   CALCULATE(SUMX(VALUES(ATC[material_style1]),[Sales_Per_unit_var]*[Quantity_CY]),ALLSELECTED(ATC[top_level_account])))
Anonymous
Not applicable

sales has to be calculated to material level hence I have used 

Price Variance =
if([Sales per Unit_CY]=0 || [Sales per Unit_PY]=0,0,
 
   CALCULATE(SUMX(VALUES(ATC[material_style1]),[Sales_Per_unit_var]*[Quantity_CY]),ALLSELECTED(ATC[top_level_account])))
 
Anonymous
Not applicable

my table values are customer no, material no,  sales amount, Quantity ,year month.
calculation require :


if the sales current year or sales previous year sales is nill  then 0 if not
==sales per unit variance( current sales /quantity - previous year sales /quantity) * quantity cy 

 

Ashish_Mathur
Super User
Super User

Hi,

Share some data, explain the question and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

giri41_0-1711214669891.png

 

Wilson_
Super User
Super User

Hi giri,

 

Please check the pinned thread in the forum to learn how to provide sufficient details to get your question answered. 🙂




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors
Top Kudoed Authors