Help with PivotTable - Summing Average Values

jr25673

New Member
Joined
Dec 24, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I had a lot of data, with multiple headers, which I unpivoted using PowerQuery. The resulting PivotTable I got was:

Column A (Restaurants): McDonald's, KFC, Burger King, etc.
Column B (Location): Seattle, San Francisco, New York, etc.
Column C (Year): 2024, 2023, 2022, etc.
Column D (Week): 1, 2, 3, ...., 52, 53
Column E (Time): 00:00:00, 00:01:00, ...., 23:58:00, 23:59:00
Column F (Sale): *this is various prices of sales recorded at the corresponding times in Column E*

Although Column A is the restaurant name, there can be numerous rows of sales at a McDonald's at 13:00:00 due to the varying locations in Column B.

For this reason, I am trying to get the sales price at 13:00:00 (for example), during week 1 of 2024, for all of the McDonald's restaurants. If we assume the sale at this time at the New York restaurant was $15.50, the Seattle restaurant was $12.75, and the San Francisco restaurant was $20; the average would be ~$16.08.

Of course, I would then like to do this for each timestamp for each week in each year for all of the restaurants in Column A. Once I have the average sale for each restaurant location at each timestamp during each week of each year, I would like to sum these averages for every restaurant (McDonald's, KFC, etc.) at each time (00:00:00, 00:01:00, etc ) for each week (1, 2, etc.) during each year (3024, 2023, etc.).

I did create multiple columns. For example, the column for McDonald's was called "McDonald's Average Sales" and used the following formula:
=AVERAGEIFS($F:$F, $A:$A, "="&"McDonald's", $C:$C, "="&[@Year], $D:$D, "="&[@Week], $E:$E, "="&[@Time])

It seems like this worked as intended (although it displays these values throughout each row even if the A cell in a row says "KFC" or "Burger King", instead of "McDonald's") but, I noticed that due to the inclusion of AVERAGEIFS, my Excel takes quite a long time to be usable as it's calculating multiple threads.

I understand that I can turn off automatic calculations to quick-fix this but, I was wondering if anyone would know of a different and more productive method of achieving what I want this Excel to do?

Any feedback is very grateful! Also, apologies for the long-winded post, this is my first thread and I wanted to provide as much information as possible! :)

Thank you in advance!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello, *jr25673. According to your description, you have single Sale record (row) per each unique combination of A through E. Then why do you calculate average Sale across all locations just to sum averages in the end? 3 times average 16.08 = 15.5 + 12.75 + 20. Use group by (Table.Group) functionality in Power Query to calculate sum of all sales across all locations for restaurant, year, week, time combo.
 
Upvote 0

Forum statistics

Threads
1,225,137
Messages
6,183,080
Members
453,146
Latest member
Lacey D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top