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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have a Clients table with client details
| Clients Id | Name | DOB | Country |
| 1 | Uk | ||
| 2 | USA | ||
| 3 | UK |
and another products table
| Product Id | Product Type | Client Id |
| 100 | P1 | 1 |
| 101 | P2 | 1 |
| 102 | P1 | 2 |
I want to get distinct country count by product type
| Product Type | Count of distinct country |
| P1 | 2 |
| P2 | 1 |
How do I achieve that?
Solved! Go to Solution.
Hi @bml123 ,
Please check this measure.
Measure =
VAR ids =
CALCULATETABLE (
VALUES ( products[Client Id] ),
FILTER (
ALLSELECTED ( products ),
products[Product Type] = SELECTEDVALUE ( products[Product Type] )
)
)
RETURN
CALCULATE (
DISTINCTCOUNT ( Clients[Country] ),
FILTER ( ALLSELECTED ( Clients ), Clients[Clients Id] IN ids )
)
Best Regards,
Jay
Hi @bml123 ,
Please check this measure.
Measure =
VAR ids =
CALCULATETABLE (
VALUES ( products[Client Id] ),
FILTER (
ALLSELECTED ( products ),
products[Product Type] = SELECTEDVALUE ( products[Product Type] )
)
)
RETURN
CALCULATE (
DISTINCTCOUNT ( Clients[Country] ),
FILTER ( ALLSELECTED ( Clients ), Clients[Clients Id] IN ids )
)
Best Regards,
Jay
Hi @bml123
Try this
Distinct Country Count by Product Type = CALCULATE(DISTINCTCOUNT([Client Id]), FILTER('Data', 'Data'[Product Type] = SELECTEDVALUE('Data'[Product Type])))
regards
Phil
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |