Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.