Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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 |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 13 | |
| 10 | |
| 10 | |
| 9 | |
| 8 |