Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all,
i have an issue with a measure wich contains weighted average
i made this measure:
below i put a source example:
Year | MonthNo | Year Month | Salesman | Quantity | City | Region | Sales1 | Sales2 |
2019 | 2 | 201902 | George | 26 | A | AAAA | 59 | 236 |
2019 | 1 | 201901 | George | 9 | A | AAAA | 68 | 68 |
2019 | 1 | 201901 | Alex | 4 | B | AAAA | 59 | 118 |
2019 | 2 | 201902 | Jenna | 10 | C | BBBB | 93 | 465 |
2019 | 1 | 201901 | Jenna | 15 | C | BBBB | 63 | 126 |
2019 | 1 | 201901 | Aimee | 8 | C | BBBB | 59 | 177 |
Solved! Go to Solution.
Hi cosminc,
According to your description, I create sample data to reproduce the scenario. Based on your original data, I add three rows data for further analysis.
Then, create measure Weighted AVG to meet your need.
Weighted AVG =
VAR S1=
DIVIDE (CALCULATE(SUM(source[Quantity])*SUM(source[Sales1])),CALCULATE(SUM(source[Quantity])),0)
VAR S2=
DIVIDE (CALCULATE(SUM(source[Quantity])*SUM(source[Sales2])),CALCULATE(SUM(source[Quantity])),0)
RETURN
DIVIDE ( S1, S2, 0 )
Choose table visual to display the result showing picture below.
Here is my test pbix file link: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EdcHWBoJeGtLqZ_sXU...
If above result doesn’t meet your requirement, please clarify your desired output.
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi cosminc,
According to your description, I create sample data to reproduce the scenario. Based on your original data, I add three rows data for further analysis.
Then, create measure Weighted AVG to meet your need.
Weighted AVG =
VAR S1=
DIVIDE (CALCULATE(SUM(source[Quantity])*SUM(source[Sales1])),CALCULATE(SUM(source[Quantity])),0)
VAR S2=
DIVIDE (CALCULATE(SUM(source[Quantity])*SUM(source[Sales2])),CALCULATE(SUM(source[Quantity])),0)
RETURN
DIVIDE ( S1, S2, 0 )
Choose table visual to display the result showing picture below.
Here is my test pbix file link: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EdcHWBoJeGtLqZ_sXU...
If above result doesn’t meet your requirement, please clarify your desired output.
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
141 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
123 | |
101 | |
71 | |
61 |