Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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. | Customer | Material | Quantity | Sales price per piece | Total sales price | Reference price per piece |
| 1 | Alpha | A | 4 | 10 | 40 | 10 |
| 2 | Beta | A | 2 | 0 | 0 | 10 |
| 3 | Gamma | A | 10 | 10 | 100 | 10 |
| 4 | Gamma | B | 8 | 0 | 0 | 5 |
Desired output:
| Customer | Total sales | Free of charge | |
| Alpha | 40 | 0 | |
| Beta | 0 | 20 | (2*10) |
| Gamma | 100 | 40 | (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!
Solved! Go to 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])
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])
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 8 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 23 | |
| 18 | |
| 16 | |
| 15 | |
| 14 |