Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
Please help! I need a DAX measure to count the numbe of customers per order per day with multiple sizes in the order?
With the sample below, I would except the following:
Jan with 1 customer with multiple sizes in the order
Feb with 2 customers with multiple sizes in the order (Customer 222 is ignored because only 1 size in order)
I have tried COUNTROWS( Sales) and
COUNTROWS( DISTINCT( Sales[Size])) and
COUNTROWS (
EXCEPT (
VALUES ( Sales[Customer ID] ),
SUMMARIZE (
GENERATE (
VALUES ( Sales[CustomerID] ),
EXCEPT (
VALUES ( Sales[Size] ),
CALCULATETABLE ( VALUES ( Sales[Size] ) )
)
),
Sales[Customer ID]
)
)
)
Any ideas?
Date | Customer ID | Order ID | Size |
1-Jan | 123 | ABC-100 | 10 |
1-Jan | 123 | ABC-100 | 12 |
3-Feb | 123 | ABC-118 | 12 |
3-Feb | 123 | ABC-118 | 14 |
7-Feb | 222 | ABC-226 | 10 |
9-Feb | 125 | ABC-234 | 8 |
10-Feb | 125 | ABC-234 | 10 |
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Thanks, that worked as expected! What if I want to add another field to the table/measure? When I add a field after Customer ID the table goes blank? Same with [Size], could that be added to the table? It goes blank when I do.
I have a field called TYPE that I want to include. The result would be:
YYYYMM | Type | # Multi Sizes |
2021-01 | Dress | 1 |
2021-02 | Dress | 1 |
2021-02 | Top | 1 |
Data:
Date | Customer ID | Order ID | Size | Type |
1-Jan | 123 | ABC-100 | 10 | Dress |
1-Jan | 123 | ABC-100 | 12 | Dress |
3-Feb | 123 | ABC-118 | 12 | Dress |
3-Feb | 123 | ABC-118 | 14 | Dress |
7-Feb | 222 | ABC-226 | 10 | Pants |
9-Feb | 125 | ABC-234 | 8 | Top |
10-Feb | 125 | ABC-234 | 10 | Top |
Thanks, that worked as expected! I notice there is no total on this measure? Is there a way to add a total (3 in this case)?
What if I want to add another field to the table/measure? When I add a field after Customer ID the table goes blank? Same with [Size], could that be added to the table? It goes blank when I do.
I have a field called TYPE that I want to include. The result would be:
YYYYMM | Type | # Multi Sizes |
2021-01 | Dress | 1 |
2021-02 | Dress | 1 |
2021-02 | Top | 1 |
Data:
Date | Customer ID | Order ID | Size | Type |
1-Jan | 123 | ABC-100 | 10 | Dress |
1-Jan | 123 | ABC-100 | 12 | Dress |
3-Feb | 123 | ABC-118 | 12 | Dress |
3-Feb | 123 | ABC-118 | 14 | Dress |
7-Feb | 222 | ABC-226 | 10 | Pants |
9-Feb | 125 | ABC-234 | 8 | Top |
10-Feb | 125 | ABC-234 | 10 | Top |
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
15 | |
13 | |
11 | |
9 | |
8 |