Aggregate calculations

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
592
Office Version
  1. 365
Platform
  1. Windows
Hello

It is very often that there is data in the below format

Product Prices:
TypeProduct
01/01/2020​
02/01/2020​
03/01/2020​
04/01/2020​
05/01/2020​
AA1
1​
2​
3​
4​
5​
AA2
6​
7​
8​
9​
10​
BB1
11​
12​
13​
14​
15​
BB2
16​
17​
18​
19​
20​
BB3
21​
22​
23​
24​
25​
CC1
26​
27​
28​
29​
30​
CC2
31​
32​
33​
34​
35​

Such data is impossible to pivot in various ways e.g. to get the average of all products per day or per week or the sum of of prices of a specific Type versus dates etc.

Obviously this can be done with SUMIFs, COUNTIFs, AVERAGEIFs but do you have any other technique to be able to quickly create aggregations and perform various aggregate calculations?

Thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I think the first step is to get the data organized in a better format. My first step would be to use Power Query to get it into something like this:

Screenshot 2022-09-10 111819.png


Once you have it in this format, you can use Pivot Tables or continue on with Power Query to aggregate the data you need. Here is the Power Query code:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table11"]}[Content],
    #"Unpivoted Only Selected Columns" = Table.Unpivot(Source, {"01/01/2020", "02/01/2020", "03/01/2020", "04/01/2020", "05/01/2020"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Date"}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"Date", "Type", "Product", "Value"}),
    #"Sorted Rows" = Table.Sort(#"Reordered Columns",{{"Date", Order.Ascending}})
in
    #"Sorted Rows"
 

Attachments

  • 1662830312419.png
    1662830312419.png
    49.6 KB · Views: 6
Upvote 0
Thanks, that's what I do but it can be quite slow, inflexible and it has the known null issue.
Rebuilding that with regular Excel formulas will be complex.
Any other way?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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