The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm relatively new to Power BI. I'd like to plot the 'simple' average of "weekly average price weight by quantity" by week. The two steps in the example below are:
1. For each row the price is 'weighted' by the quantity and averaged for each (person, week)
2. These numbers are 'simple' averaged across each person to obtain the weekly average
The raw data range is A1:E5. The desired output range is G10:H12. In Excel this is equivalent to pivoting on the pivot table, which I performed manually as shown below:
Is there a way to preprocess the data to obtain this result in Power BI?
Note: In addition to the above there are row-wise filters to be applied. The raw data, the pivot and the final weekly average price per unit should update based on the selected filters.
Solved! Go to Solution.
Hi @sathin2, try these measures below, and if you encounter any issues, let me know.
Create a calculated column:
WeightedPrice = [Price] * [Quantity]
Create a measure:
WeeklyAvgPricePerPerson =
DIVIDE(
SUM('Table'[WeightedPrice]),
SUM('Table'[Quantity])
)
Create another measure:
SimpleWeeklyAvg =
AVERAGEX(
VALUES('Table'[Person]),
[WeeklyAvgPricePerPerson]
)
Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!
Hi @sathin2, try these measures below, and if you encounter any issues, let me know.
Create a calculated column:
WeightedPrice = [Price] * [Quantity]
Create a measure:
WeeklyAvgPricePerPerson =
DIVIDE(
SUM('Table'[WeightedPrice]),
SUM('Table'[Quantity])
)
Create another measure:
SimpleWeeklyAvg =
AVERAGEX(
VALUES('Table'[Person]),
[WeeklyAvgPricePerPerson]
)
Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!
Figured out a solution:
User | Count |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
11 | |
7 |