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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors