cancel
Showing results for 
Search instead for 
Did you mean: 
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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Top Solution Authors
Top Kudoed Authors