Counting Unique Customers per Month Compared to Unique Customers Up to Each Month.

CSMcVey

New Member
Joined
Oct 30, 2012
Messages
21
I have the following tables in PowerPivot:


  1. DateTable
  2. MetricsTable
  3. CustomersTable

The Metrics table is my 'fact' table and is linked to the DateTable and CustomersTable.

I would like to graph two values on a graph with the month on the x-axis (categories)


  1. The number of unique customers, using integration, in the corresponding month
  2. The number of unique customers, using integration, in all months up through corresponding month

I have the measure built for item #1: =CALCULATE(COUNTROWS(DISTINCT('CustomersTable'[CustomerID])), FILTER(MetricsTable, [IntegrationYesNo] = "Yes"))

What I can't figure out is how to do #2, I know I am close just can't get over the hump. I am limited to PP Version 1.

Thanks in advance.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I think I can get you what you want if I modify your first measure a bit.

Instead of counting distinct employees in the CustomerTable, can you count them in the MetricsTable using their CustomerID? Otherwise, your CustomerTable and DateTable probably aren't related in anyway and are both being used as Lookup Tables for the MetricsTable.

New Measure 1:
[UniqueCustomers]:= CALCUALTE(COUNTROWS(DISTINCT('Metrics'[CustomerID])), FILTER('MetricsTable', 'MetricsTable'[IntegrationYesNo] = "Yes"))

This should give you the same result as your original equation but now we can use it to build the second measure correctly.

Measure 2:
[UniqueCustomersRunningTotal]:=CALCULATE([UniqueCustomers],DATESBETWEEN('DateTable'[Date], blank(), LASTDATE('DateTable'[Date])), ALL('DateTable'))

I believe this should give you the number of unique customers up to the current month including all previous months.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,730
Messages
6,192,699
Members
453,747
Latest member
tylerhyatt04

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