Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I am having difficulty in trying to calculate the weighted average from the dataset I have.
I have unpivoted the data in query editor due to the nature of the data in the source.
I want to work out the total weighted average per column e.g total weighted average for sp £/t, cos £/t and margin £/t. The Total row should show the weighted average
Expected:
Tonnes | SP £/t | COS £/t | Margin £/t | Margin £k | |
Downgrade | 50 | 2000 | 3000 | -800 | -50 |
Mouldy | 0 | 0 | 0 | 0 | 0 |
Traded | 20 | 4000 | 5000 | -1000 | -30 |
Total | 70 | 2571 | 3571 | -857 | -80 |
To calculate this for e.g sp £/t, i need to multiply tonnes by the sp £/t value so - ((52 * 2800) + (0*0) + (33*3030))/85
Below is the source table -
Week No | W/C | Attribute | Value |
47 | 20/11/2023 | Downgrade Tonnes | 50 |
47 | 20/11/2023 | Downgrade SP £/t | 2000 |
47 | 20/11/2023 | Downgrade COS £/t | 3000 |
47 | 20/11/2023 | Doiwngrade Margin £/t | -800 |
47 | 20/11/2023 | Downgrade Margin £k | -50 |
47 | 20/11/2023 | Mouldy Tonnes | 0 |
47 | 20/11/2023 | Mouldy SP £/t | 0 |
47 | 20/11/2023 | Mouldy COS £/t | 0 |
47 | 20/11/2023 | Mouldy Margin £/t | 0 |
47 | 20/11/2023 | Mouldy Margin £k | 0 |
47 | 20/11/2023 | Traded Tonnes | 20 |
47 | 20/11/2023 | Traded SP £/t | 4000 |
47 | 20/11/2023 | Traded COS £/t | 5000 |
47 | 20/11/2023 | Traded Margin £/t | -1000 |
47 | 20/11/2023 | Traded Margin £k | -30 |
Any help is appreciated!
Thanks
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
92 | |
83 | |
71 | |
49 |
User | Count |
---|---|
143 | |
120 | |
110 | |
59 | |
57 |