Returns an estimated count of unique values in a column.
Quick Coach Video |
What it does? Returns an estimated count of unique values in a column. Syntax APPROXIMATEDDISTINCTCOUNT([Column]) Returns The approximate number of distinct values in a column. |
What is the APPROXIMATEDISTINCTCOUNT Function?
The APPROXIMATEDDISTINCTCOUNT function in DAX is like a friendly bouncer at a popular night club! Instead of counting every single person who walks in, they give you a close estimate of how many unique guests have entered. This is super handy when you’re dealing with large crowds – just like when you want to know how many different customers visited your store last month!
This function accepts a single argument, which is a column. You can use columns with any type of data. If the function doesn't find any rows to count, it returns a BLANK; otherwise, it returns the count of distinct values.
Try It
This content is part of our Aggregates DAX class that can be taken here.
Example 1: Unique Pizza Toppings
Imagine you own a pizza restaurant, and you want to know how many unique toppings were ordered over the weekend. Here’s how your sales data might look:
Day |
Topping |
Saturday |
Pepperoni |
Saturday |
Mushrooms |
Saturday |
Olives |
Sunday |
Pepperoni |
Sunday |
Green Peppers |
To find out how many unique toppings were ordered, you’d use the APPROXIMATEDDISTINCTCOUNT function like this:
Unique Toppings = APPROXIMATEDDISTINCTCOUNT(Sales[Topping])
So how many unique toppings did you serve? You’ve got Pepperoni, Mushrooms, Olives, and Green Peppers – that’s 4 unique toppings! Time to whip up some special pies!
Example 2: Movie Night Madness
Now, let’s say you’re organizing a movie night with friends, and you want to know how many different movies everyone brought. Here’s your data:
Friend |
Movie Title |
Devin |
Back to the Data |
Ace |
Sixteen Candle Charts |
Greg |
Back to the Data |
Angelica |
Sixteen Candle Charts |
Julie |
Dirty DAXing |
To find how many unique movies were bought, you’d use the function like this:
Unique Movies = APPROXIMATEDDISTINCTCOUNT(Movies [Movie Title])
Counting the unique titles gives you 3 different movies: Back to the Data, Sixteen Candle Charts, and Dirty DAXing . Movie night is going to be epic!
Conclusion: Count the Unique Values!
The APPROXIMATEDISTINCTCOUNT function is your reliable ally for quickly estimating how many unique items you have, whether it’s pizza toppings, movie titles, or even customers. With just a simple function, you can gain insights without getting bogged down by the details.
So, what are you waiting for? Get counting those unique items and make your data shine!
Still Stuck?
This content is part of our Aggregates DAX class that can be taken here. We also have a Virtual Mentor program to get you unstuck.