Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
sathin2
New Member

Pivoting a pivot table in Power BI

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:

sathin2_2-1724951786890.png

 

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.

1 ACCEPTED SOLUTION
ahadkarimi
Solution Specialist
Solution Specialist

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!

View solution in original post

2 REPLIES 2
ahadkarimi
Solution Specialist
Solution Specialist

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:

SimpleWeeklyAvg1 =
AVERAGEX(
    SUMMARIZE('Table', [Person], [Week], "WeeklyAvgFrequencyPerPerson1", 'Table'[WeeklyAvgPricePerPerson]),
    [WeeklyAvgFrequencyPerPerson1]
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.