Distinct Count & Prevalence Automation in PowerPivot?

sunnyBNH013

New Member
Joined
Nov 30, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello all! First time poster here and I'm struggling to find a solution to my problem:

Ideally, what I'd like to be able to achieve is automation of these calculations using Power Pivot, if possible. Here in my pivot table, I have Restaurants with the IDs of individuals along with the occurrences (how many times one purchased from said restaurant). The calculations I'm wanting to automate are 1. a Distinct Count (using the formula
Excel Formula:
COUNTIF(N4:R4,">0")
) for each row of restaurants and 2. a Prevalence calculation, which takes the Distinct Count from said row divided by the total count.

Is there any way to automate this using Calculated Fields/etc in Power Pivot? Appreciate your willingness to help!

SamplePivotTable_30NOV.xlsx
ABCDEFGHIJKL
1IDRestaurant
21McDonalds
31Burger King
41McDonalds
51Burger KingTotal Count = 31
61Chick-fil-ACount of RestaurantColumn LabelsDistinct Count- "=COUNTIF(N4:R4,">0")"Prevalence Calculation- Distinct Count Divided by Total Count
71McDonaldsRow Labels12345Grand Total413%
82Chick-fil-ABrusters16183
92Taco BellBurger King25182
102Taco BellChick-fil-A11463
112Taco BellFreddy's1121
123BrustersMcDonalds331
133Freddy'sTaco Bell314
144Chick-fil-AGrand Total71524331
154Chick-fil-A
164Chick-fil-A
174Chick-fil-A
181Brusters
192Brusters
205Freddy's
212Burger King
222Burger King
232Burger King
242Burger King
252Burger King
265Burger King
275Taco Bell
282Brusters
292Brusters
302Brusters
312Brusters
322Brusters
Sheet1
Cell Formulas
RangeFormula
L7L7=K7/31
K7:K12K7=COUNTIF(D7:H7,">0")
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

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