Monthly and Weekly Distinct Count

rickster97

New Member
Joined
May 12, 2022
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I want to calculate unique customers / week, such that, when I add them up I get the same number of unique customers / month.

I have the following PowerPivot table:
1652359512883.png

Total customers (took distinct count of customer ID) per month were:
1) January (ene): 1
2) February (feb): 28
3) March (mar): 219
4) April (abr): 416

I actually made a Week Column (Columna 1) in the original database but it still doesn't work the way I need it to (red numbers are the sum of all weeks for a given month):
1652360239456.png


Can anyone help please?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The problem you're suffering from is the way Pivot tables calculate their values. Each value is independent of the others around it. To calculate any particular value one step is to define the 'filter context' of the cell. So for Feb, Semana 3 as an example. It will calculate the Distinct Customer IDs in Semana 3 of Feb, in this case 7. To Calculate the Subtotal the filter context is only Feb (ie all weeks in the month) and it finds only 28 distinct values. The reason you anticipate 30 is because some customers were present in more than one week in the month so they appear multiple times across the weeks that comprise Feb.

I believe there may be ways around this, but it can be very frustrating. Google 'incorrect totals in PowerPivot'.

HTH
 
Upvote 0
The problem you're suffering from is the way Pivot tables calculate their values. Each value is independent of the others around it. To calculate any particular value one step is to define the 'filter context' of the cell. So for Feb, Semana 3 as an example. It will calculate the Distinct Customer IDs in Semana 3 of Feb, in this case 7. To Calculate the Subtotal the filter context is only Feb (ie all weeks in the month) and it finds only 28 distinct values. The reason you anticipate 30 is because some customers were present in more than one week in the month so they appear multiple times across the weeks that comprise Feb.

I believe there may be ways around this, but it can be very frustrating. Google 'incorrect totals in PowerPivot'.

HTH
I understand that I get a total of 30 for February because there were 30 purchases made by 28 clients.
What I would like to be able to get sort of "automatically" is the following:

Total Unique Clients February:
Week 1: 5
Week 2: 9
Week 3: 6
Week 4: 8
Total: 28

I actually figured a manual 4-step approach to get weekly results but it is not practical given the amount of data I have to analyze.
Contrary to most videos I don't want to delete the total or make the total 30 (February). I want the total to remain 28 (February), so that each week only includes customers that made their first purchase of the month during that week.

Thanks in advance.
 
Upvote 0
I feel sure its possible, but it will require a fairly complex 'measure'. I would recommend moving this thread to the 'Powertools' forum as there is some truly inspirational Powerquery/Powerpivot knowledge there.
 
Upvote 0
I feel sure its possible, but it will require a fairly complex 'measure'. I would recommend moving this thread to the 'Powertools' forum as there is some truly inspirational Powerquery/Powerpivot knowledge there.
Thank you. I have posted this thread in the "Powertools" forum now.
 
Upvote 0
Hi,

I want to calculate unique customers / week, such that, when I add them up I get the same number of unique customers / month.

I have the following PowerPivot table:
View attachment 64481
Total customers (took distinct count of customer ID) per month were:
1) January (ene): 1
2) February (feb): 28
3) March (mar): 219
4) April (abr): 416

I actually made a Week Column (Columna 1) in the original database but it still doesn't work the way I need it to (red numbers are the sum of all weeks for a given month):
View attachment 64482

Can anyone help please?
I have tried using PowerBI but still can't figure it out.
Does this seem like a solvable problem?
 
Upvote 0
Measures in PowerBI or PowerPivot rely on the same 'engine'. I think its possible, but I also think it'll be quite a complex measure. Sorry I cant be more help.

Regards
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,957
Latest member
Hat4Life

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