Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello.
I've been trying to figure out how many customers are buying X% of our products.
In my work in progress file (linked below), I've figured out those customers that purchased 25% of our products are ranked 1 thru 37. However, because there are ties, there's actually 41 customers in this cohort. But, I don't know how to write a DAX that shows 41 instead of 37.
So, because I figured out the rank, I need either a DAX that can:
1) Calculate N customers less than or equal to X% of total
or
2) Calcualte N customers at less than or equal to Y rank including ties
Thanks!
Solved! Go to Solution.
Figured it out. Actually it wasn't that hard:
Any particular reason for not using PERCENTILEX for this?
Yup. I never even heard of that function before....
I would recommend starting with that PERCENTILEX.INC function (DAX) - DAX | Microsoft Learn - it will make your request much easier to implement.
After watching a few videos, I am not sure how to apply the function to my dataset.
If I knew how to apply the percentile function onto my dataset after it's summarized, it can tell me what my units distribution are. However, I already have that albeit not using the percentile function. Further, I don't know how to use summarize and percentile function together, so the result is always 1, because each row of data holds only 1 unit.
What I need is not a unit distribution but the # of customers who purchased up to a percentile's threshold.
1. identify the products for each percentile
2. lookup the customers who purchased these products ( use the result of 1 as a filter)
I already did that in my test file. However, I need that in a stand alone dax without using filters.
won't work without filters, but these filters can come from table variables. Something along these lines:
var x25 = percentilex.inc(products,0.25)
return countrows(filter(values(customer name), product in x25))
with my data set this won't work. every row is one unit so no matter what % you use the distribution will be one.
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
27 | |
12 | |
11 | |
10 | |
6 |