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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cdawidow
Helper III
Helper III

SUMX TOTALS DO NOT MAKE SENSE

Hi guys,

 

I wanted to do a basic calculation using sumx to model the changes to total sales when discounts are modified based on a criteria but I can see that my total is largely over than expected.  The measure is listed below.  

 

Measure 3 =
var __cust = FILTER( ALLSELECTED(SALES[PI]), [AVERAGE SPEND] > 0 )
return
SUMX(
FILTER(
VALUES(SALES[PI]),
[AVERAGE SPEND]>0
),
IF(HASONEFILTER(CUSTOMERS[CNAME]),([LIST PRICE]*(1-[PROPOSED DISCOUNT]))*[AVERAGE QUANTITY SOLD],SUMX(VALUES(CUSTOMERS[CNAME]),([LIST PRICE]*(1-[PROPOSED DISCOUNT]))*[AVERAGE QUANTITY SOLD])))
 
Essentially, I calculate each customers spend across all their skus where there is a sale, and model the new sales amount based on the new discount i set.  it works individually but not when I calcualte these proposed changes for all the customers as shown below
 
totals.PNG

 Any help would be appreciated !

 
2 REPLIES 2
AlexisOlson
Super User
Super User

Your measure is pretty difficult to understand but I'm guessing you can simplify it into something more like this:

SUMX (
    VALUES ( CUSTOMERS[CNAME] ),
    SUMX (
        CALCULATETABLE ( VALUES ( SALES[PI] ), [AVERAGE SPEND] > 0 ),
        [LIST PRICE] * ( 1 - [PROPOSED DISCOUNT] ) * [AVERAGE QUANTITY SOLD]
    )
)

 

I'm making quite a few assumptions here, so I don't necessarily expect this to work but it might be a place to start from.

Hi there,

 

Thanks for your help.  It didnt work.

 

Essentially, I just want the total to be the correct sum of each individual account above for measure 3.  The measure is being calculated correctly but the total is way over than what is expected

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors