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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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