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
RonSon2015
Frequent Visitor

SUMX filter (value smaller 1) does not find correct results

Hello,

After trying many different formul and search terms I cannot find a solution for the following problem.

I've got a fact table with sales by customer and product. However, it could happen that products are given for free. In this case it should calculate the missed sales (free of charge) by multiplying the quantity with the reference price.

Fact table:

Invoice No.CustomerMaterial   QuantitySales price per pieceTotal sales priceReference price per piece
1AlphaA4104010
2BetaA20010
3GammaA101010010
4GammaB8005

 

Desired output:

CustomerTotal salesFree of charge
Alpha400 
Beta020(2*10)
Gamma10040(8*5)

 

My idea which is not working (result on lowest level as well as on aggregated level is wrong):

 

Missed sales = SUMX(

FILTER ( Fact_Table; Sales price per piece < 1) ;

Quantity * Reference price per piece

)

 

(smaller 1 because some products are not given at zero but for some cents)

 

 

Thanks for any hints and suggestions in advance!

1 ACCEPTED SOLUTION

Here's a modified measure

 

free of charge 2 = 
var c=SUMMARIZE('Table','Table'[Customer],"free",sumx('Table',if('Table'[Sales price per piece]=0,'Table'[Quantity]*'Table'[Reference price per piece],0)))
return sumx(c,[free])

 

lbendlin_0-1632423776344.png

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

see attached.  You didn't mention if you wanted working totals.

Thank you for your effort to create that example in PowerBI. It's a solution but I also need working totals to answer the question: What is the total value of freebies and then to analyze to what customer and what products were given for free.

Here's a modified measure

 

free of charge 2 = 
var c=SUMMARIZE('Table','Table'[Customer],"free",sumx('Table',if('Table'[Sales price per piece]=0,'Table'[Quantity]*'Table'[Reference price per piece],0)))
return sumx(c,[free])

 

lbendlin_0-1632423776344.png

 

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