Aggregation in Calculated Column

AlexNYExcel

New Member
Joined
Jul 31, 2015
Messages
11
Forgot how wrote formula that able to calculate including Group from Row-level - but I need it ASAP.

Example, we have Sales data of bikes and table with products
there are some columns: bike id, bike model, # of units sold, price, bike group (ex. mountain, kids, etc.).
I am looking for calculated column that will show same values for bike group.
Hurdle that we connect sales data to product by using bike id, and there is nothing in sales data what will show us bike group (for e.g. to USERELATIONSHIP).

hope you will help:):)
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi there,
From what you've said, you want to add a calculated column to your Sales table that gives you, on each row, the total for the current row's Bike Group (which is sitting in the related Products table). Is that right?

Something like this should work as a calculated column in Sales (adapted to your table/column names etc):
Code:
=
CALCULATE (
    SUM ( Sales[Sales Amount] ),
    ALL ( Sales ),
    CALCULATETABLE ( VALUES ( Products[Bike Group] ) )
)


  • Replace SUM ( Sales[Sales Amount] ) with whatever calculation you want from your Sales table.
  • ALL ( Sales ) clears all filters from the current row; this could be changed to ALLEXCEPT( Sales, ...) to leave certain filters in.
  • CALCULATETABLE ( VALUES ( Products[Bike Group] ) ) adds a filter on Bike Group corresponding to the current row.
 
Last edited:
Upvote 0
Hi there,
From what you've said, you want to add a calculated column to your Sales table that gives you, on each row, the total for the current row's Bike Group (which is sitting in the related Products table). Is that right?

Something like this should work as a calculated column in Sales (adapted to your table/column names etc):
Code:
=
CALCULATE (
    SUM ( Sales[Sales Amount] ),
    ALL ( Sales ),
    CALCULATETABLE ( VALUES ( Products[Bike Group] ) )
)


  • Replace SUM ( Sales[Sales Amount] ) with whatever calculation you want from your Sales table.
  • ALL ( Sales ) clears all filters from the current row; this could be changed to ALLEXCEPT( Sales, ...) to leave certain filters in.
  • CALCULATETABLE ( VALUES ( Products[Bike Group] ) ) adds a filter on Bike Group corresponding to the current row.


thank you, it is exactly what I was searching.
Actually I wanted put column in Products table, to assign to groups Sales Bracket (e.g. 100m+, 10m+, 1m+, etc.)
but it was easy to adjust:)
 
Upvote 0

Forum statistics

Threads
1,224,146
Messages
6,176,667
Members
452,740
Latest member
CoelhoVermelho

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