Count Distinct in Pivot Table when there are Page Fields

dgacorp

New Member
Joined
Apr 12, 2016
Messages
3
Hi, I have a problem with Excel and I'm writing hoping you can help me.

I have Excel 2010 (with Excel 2013 problem seems to be resolved), with a large table of data, and a pivot on this table. This pivot contains page fields, and in value fields I have to count infos of a column "NDC". But I have to count data with DISTINCT values.
So I googled a lot, and I found a remedy: I added a column in the initial table of data, so that if a value appears for the first time in a row, in the corresponding column added I have a "1"; if that value is repeated in consequent rows, I have a "0".


For example:


NDC ADDED COLUMN
1 1
1 0
2 1
3 1


In my pivot, than I got the sum of the added column, obtaining distinct count of "NDC".


However, this is a partial remedy, because, if I have page fields that can FILTER the original table data, sum of the added column is no more a correct total.


In fact, suppose this situation:




NDC A.C. F
1 1 S
1 0 N
2 1 N
3 1 N



If in Page Fields I have the field "F", and I choose to view only values "N", then my pivot counts 0 for NDC "1", 1 for NDC "2", 1 for NDC "3", and totals 2 instead of 3.


How can I resolve this problem? There is a workaround (using macro, or another more complex formula)?


Thank you and sorry for my english, I hope you understand me.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

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