Subtotal question

heatherrink

New Member
Joined
Oct 29, 2012
Messages
5
Hi there

I have a question please -

I have the following data in powerpivot - Products prescribed by individual practices roll up to Regions in a hierarchy. I have inserted calculated columns to get the subtotals for all the products within a region through
=CALCULATE(SUM([prescriptions]),FILTER('data','data'[Regions]=EARLIER('data'[Regions])))

However is there a way to get the subtotal by individual product within the region? I tried
=CALCULATE(SUM([prescriptions]),(FILTER('data','data'[Regions]=EARLIER('data'[Regions])),(FILTER('data',data[Product]=EARLIER('data'[Product]))))), but didnt get any success.

Could you help me please?

Thanks very much!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This should work. If not Tianbas will fix you up. Brother loves calculated columns ;-)
Code:
=CALCULATE(SUM([prescriptions]),
   FILTER(data,
             data[Regions]=EARLIER(data[Regions])
             && data[Product]=EARLIER(data[Product])
             )
   )
 
Upvote 0

Forum statistics

Threads
1,224,019
Messages
6,175,960
Members
452,688
Latest member
spookralls

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