Question on CountRows Distinct: can I use at the record level?

pete234

Active Member
Joined
Feb 10, 2004
Messages
419
I would like to know if I can use some form of COUNT DISTINCT at the powerpivot table level?
The following works fine for counting the table but I need it to count the UNIQUE phone #'s by Salesperson and Day.
I am not sure if CALCULATE could somehow help with this or not.
It could also just return a flag of "1" if the number is unique for a day, so I can sum those later.

=COUNTROWS(DISTINCT(Calls[Destination#]))

I realize I could feed this to a pivot table and use CountDistinct but in this instance I need the data flat.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
at the powerpivot table level you could create a calculated column with:
Phone# & Salesperson & day

and then do a distinctcount on that column

Hope this helps.
 
Upvote 0
If you need to do a distinct count on many columns, a good approach can be that of using a measure like:

Code:
=COUNTROWS (
    SUMMARIZE (
        MyTable,
        MyTable[SalesPerson],
        MyTable[PhoneNumber],
        MyTable[Day]
    )
)

In this way, you avoid storing a calculated column with many distinct values, which might eat your memory pretty fast. :)

Alberto
SQLBI
 
Upvote 0
Fortunately, I'll only have a few thousand record by week's end and then it will reset.
I opted to concatenate Name, Phone and Date and once I extract the table, use asap utilities to remove dupes but leave one which will roll count to pivot table.
Using SUMMARIZE did not yield a workable result as it still gave a running for the table itself.
 
Upvote 0

Forum statistics

Threads
1,223,934
Messages
6,175,487
Members
452,648
Latest member
Candace H

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