Forum Discussion
Calculating weighted averages per material
Hello everyone, I am new with PowerBI and have to use it for my internship.
I am almost done with my work, but there is one step I cannot complete.
As you can see below, I have this table with product_id's, weights per material and the amount of #units sold.
I want to calculate the average weight for each material per sale. When I try to calculate the average, it just gives me the mean as if we sold one of each product. However, I want to calculate the weighted average per material, including the #units sold.
Calculating the average weight is also easy as it is the sum of
sales weight / sum #units sold.
However, as they are all in the same column I have not yet managed to calculate this for each individual material: Cotton, Polyester, rPEt etc.
As Monday is the deadline and I really want to include this, I would greatly appreciate any help.
Thank you in advance.
3 Replies
- AnonymousNot applicable
Just to make it more clear I need it for this table. As you can see the average weight for cotton (katoen) for example is 0.64kg while the weighted average should be around 0.3. I divided all average weights by 2 to get a closer number but this is obviously not the correct way to do this
- Ashish_Mathur
Super User
Hi,
Share the download link of the PBI file.
- AnonymousNot applicable
Hi, thank you for your reply.
I do not think my internship company allows me sharing the file as it contains company data. On top of that, the sales numbers come from a directquery, so I do not think you are able to properly access them. If there is any other way I can make it more clear or explain better what I need, please let me know.