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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rischav
Frequent Visitor

Counting IDs in a another table by a common key

Need a quick help! Spent my whole evening finding the following:
120394344_10164096654450587_5767179960925348615_n.jpg
I have two tables, G(Accounts, REF 1) and F(Super Account, Accounts). They both have a common key Accounts. At the moment in G table I'm counting the number Ref IDs by Account. So account 10 has 4 Ref IDs, 11 has 2 and 23 has 5.
 
Now, in table F, accounts is a subset of Super account.. When I drag Accounts from table F and count of Ref ID from Table G in a table visual, I get the total counts of Ref IDs that is 11 for all rows and not the count for each account.
 
My ultimate need is to count ref ids by super accounts that comprises of the accounts. Need help
 

 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

At least 2 ways to solve your issue,

  1. Create relationship between F and G with Accounts column as key
  2. Without physical relationship, use TREATAS func to establish virtual relationship for your measure

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!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

For 2 tables to be filtered at the same time, you have to create a relationship between them (direct or indirect). You should have 2 tables: Accounts with only unique accounts and Super Accounts with only unique super accounts. Your G and F tables would then be fact tables (hidden from view). This way you'd connect your dimensions to your fact tables on the relevant fields. Then, you'd create relevant measures. They would be easy to create as the structure I described already does the heavy lifting.
CNENFRNL
Community Champion
Community Champion

At least 2 ways to solve your issue,

  1. Create relationship between F and G with Accounts column as key
  2. Without physical relationship, use TREATAS func to establish virtual relationship for your measure

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!

Thank you so much for taking the time to reply! It worked! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.