Excluding row item from a group calcuation

masplin

Active Member
Joined
May 10, 2010
Messages
413
I would like to compare results from one of my shops with the result form all my other shops EXCLUDING the shop in question.

so I have pivot table with [Location Name] as rows. In values I have [Transactions per hour per store] and I have been able calculate the transactions per hour for all shops using

Code:
CALCULATE(                       [Trans per hour per store],ALL(Location[Location Name])
                       )

However what i really want is to calculate this excluding the location on that row. For example

Location Trans/h Trans/h for others
A 10 25 (av B&C)
B 20 20 (A&C)
C 30 15 (A&B)

Is this possible ?

Thanks
Mike
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Mike,
It sure is possible.

(Note: I'm assuming your [Trans per hour per store] measure will average over all stores in the filter context, otherwise this would need to be changed to an appropriate average in the below measure.)

One possible measure is:

Code:
Trans per hour for other locations := CALCULATE([Trans per hour per store],
       FILTER(ALL(Location[Location Name]),
       NOT(  CONTAINS(VALUES(Location[Location Name]),Location[Location Name],Location[Location Name] )  )  )

It uses a FILTER over all locations to include only those not in the current filter context. So it will work for any number of locations in the current filter context.
I have to admit, the repeated references to [Location Name] within CONTAINS look confusing when written out!

Would be interested in others' solutions.
 
Upvote 0
That looks awesome, Ozeroth! :)

Didn't try it ... at all, but I'm wonder if this slightly different (but same idea) measure would work:

Code:
Other Locations := CALCULATE([Trans per hour per store],
       FILTER(ALL(Location[Location Name]),  Location[Location Name] != VALUES(Location[Location Name]))

Probably the VALUES() will end up blowing up on grand totals, so probably:

Code:
Other Locations := IF (HASONEVALUE(Location[Location Name]),
       CALCULATE([Trans per hour per store],
       FILTER(ALL(Location[Location Name]),  Location[Location Name] != VALUES(Location[Location Name]))
  )

No better, same idea, and generally pretty cool.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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