March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
115 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |