Average of a distinct count based on criteria


New Member
Aug 24, 2017
I'm new to power pivots and dax formulas.

Does anyone know how I can work out the average value of distinct count based on a criteria?
Let's assume I have the tables below

Customer Table
Customer - Region
a - AA
b - AA
c - BB
d - CC

Product Table
Product - Type
1 - X
2 - X
3 - Y
4 - Z

Sales Table

Time - Product - Customer
Day 1 - 1 - a
Day 1 - 2 - a
Day 1 - 3 - a
Day 1 - 1 - b
Day 1 - 2 - c

On any given day (which I can use a power pivot filter for) how do I create a DAX formula that tells me region AA saw 3 unique product types purchased?

Hoping this is easy enough for the experts. :)

Matt Allington

MrExcel MVP
Dec 18, 2014
You need this measure. =distinctcount(sales[product])

you cna then filter on day and region, and the above will give you the result. If you want to know region a specifically, then you need this.



New Member
Aug 24, 2017
Thanks Matt,

This works perfectly when I need to see results for just one region. But how do I tweak this so it shows me the average number of product types purchased by all regions.

So using my above example region AA saw 2 product types purchased (X & Y) whereas regions BB and CC saw 1 product type purchased.
So using my formula if I applied no filter to my power pivot I would like it to display the result 1.33 which is the average of 2,1 & 1 : (2+1+1)/3

Hopefully this makes sense.

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...