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

Desktop

Hello,

How to count records that are not appearing in other table joining by id?

 

Thanks, appreciate any help

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi, @Anonymous 

Thank you very much for your reply. In many-to-many relationships, related functions cannot be used. This is shown in the figure below:

vjianpengmsft_0-1711435335807.png

vjianpengmsft_1-1711435403897.png

Here's how I solved it:

 

record1 = 
VAR _recordintable2 = CALCULATE(MAX('Table 2'[record]),ALL('Table 2'[record]))
RETURN
CALCULATE(MAX('Table'[record]),FILTER('Table','Table'[record]<>_recordintable2))

 

Here are the results:

vjianpengmsft_2-1711435621442.png

I've provided the PBIX file for this time below, and it would be great if it could help you. If you're not familiar with the DAX functions above, you can follow the links below to learn what they do and what they return.

ALL - DAX Guide

VAR keyword (DAX) - DAX | Microsoft Learn

VAR - DAX Guide

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

Anonymous
Not applicable

Thank you so much!!

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi Jianpeng, thanks for the quick response! When tried to use your measure got an error that column on table 2 or relationship between table 1 and table 2 doesn't exist. And i have relationship many to many for these tables with the same [ID].

We use Life connection in Power bi. I tried to use Related before and it always gives me an error. Any ideas?

Many thanks

Anonymous
Not applicable

Hi, @Anonymous 

Thank you very much for your reply. In many-to-many relationships, related functions cannot be used. This is shown in the figure below:

vjianpengmsft_0-1711435335807.png

vjianpengmsft_1-1711435403897.png

Here's how I solved it:

 

record1 = 
VAR _recordintable2 = CALCULATE(MAX('Table 2'[record]),ALL('Table 2'[record]))
RETURN
CALCULATE(MAX('Table'[record]),FILTER('Table','Table'[record]<>_recordintable2))

 

Here are the results:

vjianpengmsft_2-1711435621442.png

I've provided the PBIX file for this time below, and it would be great if it could help you. If you're not familiar with the DAX functions above, you can follow the links below to learn what they do and what they return.

ALL - DAX Guide

VAR keyword (DAX) - DAX | Microsoft Learn

VAR - DAX Guide

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Thank you so much!!

 

Ashish_Mathur
Super User
Super User

Hi,

Share some data, explain the question and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi, @Anonymous 

Based on your description, I have created the following sample data:

table1:

vjianpengmsft_0-1711071621379.png

table2:

vjianpengmsft_1-1711071651579.png

Relationship:

vjianpengmsft_2-1711071733108.png

 

Based on your description, find out which records are not in Table 2:

DAX formula:

record1 =
CALCULATE (
    MAX ( 'Table'[record] ),
    FILTER ( 'Table', 'Table'[record] <> RELATED ( 'Table 2'[record] ) )
)

In Table Visual, we use the id field in Table1 and this measure, and the result is as follows:

vjianpengmsft_3-1711072495030.png

vjianpengmsft_4-1711072780451.png

 

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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