Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
Can you please help me writing following DAX formula:
I want to calculate no of customer who have both product A and B only as Measure. Can you please advise me on it. Thanks!
| Customer ID | Product Type |
| 1 | A |
| 1 | A |
| 1 | B |
| 2 | A |
| 2 | B |
| 2 | B |
| 3 | A |
| 4 | B |
| 5 | B |
Solved! Go to Solution.
@Anonymous , Try like
countx(filter(summarize(Table, Table[Customer], "_1", calculate(distinctcount(Table[Product Type]), filter(Table,[Product Type] in {"A", "B"}))), [_1]=2),[Customer])
HI @Anonymous ,
Try the below measure:
test =
VAR test1 =
IF (
CALCULATE (
DISTINCTCOUNT ( 'Table'[Product Type] ),
FILTER ( ALL ( 'Table' ), 'Table'[Customer ID] = MAX ( 'Table'[Customer ID] ) )
) > 1,
1,
0
)
RETURN
test1sumcount = CALCULATE(DISTINCTCOUNT('Table'[Customer ID]),FILTER('Table',[test]>0))
And final get:
Wish it is helpful for you!
Best Regards
Lucien
HI @Anonymous ,
Try the below measure:
test =
VAR test1 =
IF (
CALCULATE (
DISTINCTCOUNT ( 'Table'[Product Type] ),
FILTER ( ALL ( 'Table' ), 'Table'[Customer ID] = MAX ( 'Table'[Customer ID] ) )
) > 1,
1,
0
)
RETURN
test1sumcount = CALCULATE(DISTINCTCOUNT('Table'[Customer ID]),FILTER('Table',[test]>0))
And final get:
Wish it is helpful for you!
Best Regards
Lucien
@Anonymous , Try like
countx(filter(summarize(Table, Table[Customer], "_1", calculate(distinctcount(Table[Product Type]), filter(Table,[Product Type] in {"A", "B"}))), [_1]=2),[Customer])
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!