Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to count distinct with relationships?

Hello,

 

I have these relationships in my data model, everything is connected using the In-links -> ID

 

peetman_0-1612374026532.png

 

I would like to count distinct the values in SWT_Module (ID) that are linked to c_CustomerID in the first box and display in a Pivot Table in Excel.

Something like the following:

  • c_CustomerID 3
    • ID 4
    • ID 9

 

count distinct = 2

 

4 REPLIES 4
Anonymous
Not applicable

@Anonymous 
Try: 

 

calculate(distinctcount('SWT_Module'[ID]), filter('SWT_Module', 'SWT_Module'[ID] in values('STR_A_Sample'[c_CustomerID])))

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

that is necessary but not sufficient. They need to be connected the right way.  Think of a street analogy with one way streets and two way streets etc.  Can you travel from your starting table all the way to the destination table?  Generally you cannot travel from one dimension table to another dimension table in a star schema unless you sacrifice search filter directions by making one of the connections bidirectional.

lbendlin
Super User
Super User

Follow the arrows in your data model. You can't do your count distinct with your current configuration - these two tables cannot talk to each other.

Anonymous
Not applicable

Why? All the tables are connected.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.