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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.