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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors