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! Learn more

Reply
Anonymous
Not applicable

Count all records from another table

Hi All, 

 

I have not found a way to do this at all yet, help would be appreciated. It should be relatively straightforward. I have a primary table of submitted records and a larger table with all non-submitted and submitted records. I need to be able to calculate headcount as a count of all non-submitted and submitted records. 

 

I have two tables:

 

Table 1 is the primary table and all statistics on submitted records are calculated. This table is only submitted records so as to maximise performance of the report and graphs. Most pages in the report uses Table 1 only.

TimeFrameCodeSlicerIDUserStatus
1 2020Course13ID2User 2Submitted
1 2020Course14ID3User 3Submitted
3 2019Course24ID4User 4Submitted

 

Table 2 has all records, both submitted and not submitted. 

TimeFrameCodeSlicer IDUserStatus
1 2020Course13ID1User 1DNR
1 2020Course13ID2User 2Submitted
1 2020Course14ID3User 3Submitted
3 2019Course24ID4User 4Submitted
4 2019Course25ID5User 5DNR
5 2019Course25ID6User 6DNR

 

Expected result:

For all courses in Table 1 I would like to be able to calculate the total number of distinct users in table 2. 

 

The headcount I would expect for Course 1 is 3.

 

I would like a dynamic measure so I can aggregate above the course level. This is why I have not used Summarized tables or calculated columns if I can avoid them. 

 

I have spent a few hours on this and while I can calculate it from Table 2 easily, it breaks when I try to use it with relationships. 

 

Help would be greatly appreciated. 

 

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Good morning, I have a table that has the detail of all the invoices of all the suppliers (Table invoices) and another that has the detail some of the proeveedores, I would like to know how I do to count the invoices, but only of the suppliers that coincide with those of the table of selected suppliers.

Agrdezco of antemmano the help.

Greg_Deckler
Community Champion
Community Champion

@Anonymous  - First, you mention Course 1 but I do not see a course 1 in your data. Where you referring to Course 13 and there should be 2 users, one that registered and one that did not?

 

How are the tables related to one another? Or how are you attempting to relate the tables to one another?

 

You could just leave them unrelated to one another and do something like:

 

Measure = 

  COUNTROWS(

    FILTER('Table2', 'Table2'[Course] = MAX('Table1'[Course]) && 'Table2'[TimeFrameCode] = MAX('Table1'[TimeFrameCode]))

  )

 

Something along those lines for example. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks so much @Greg_Deckler 

There is a course1 there 3 is in the slicer column. I cant seem to get the tables clearer than that.

The tables are currently linked by ID bi directional. 

I'll try the formula shortly - frozen screen 😞 at the moment

Anonymous
Not applicable

Hi @Greg_Deckler ,

Cant seem to get it working. I have created a pbix file that illustrates my particular issue. I have not linked the tables together in this. 

https://unsw-my.sharepoint.com/:u:/g/personal/z3521828_ad_unsw_edu_au/EXByMUKmgOxLqeLUERK5IwIByj0tIz... 

@Anonymous  If you disable the relationship, it will work. Do you really need relationship between these two tables?


Regards,
Nandu Krishna

Anonymous
Not applicable

thanks @nandukrishnavs  I have tried the calculation with no relationships between the tables. Unfortunately its not working. 

Headcount =
COUNTROWS(
FILTER(ALL('Table 2'), 'Table 2'[Code] = MAX('Table 1'[Code])
))
 
PBIX is attached.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors