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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
P_P2595
Helper I
Helper I

Want to create a measure with no relation between two table

Hi All,

I would like to create a measure to check if the IDs are present in both tables or not but there is no relationship between the

two tables.
Table 1:

IDRoleProvider
1PsyABC
2SpeechDEF
3OTXYZ
4STEDC

Table 2:

IDRoleProvider
1PsyABC
2SpeechDEF
6OTTGB
7SPQAZ

 

I want to create a measure to find the difference of values between two tables.
Output:

Table 1Table 2 Diff
422

So  4 is total IDs from the first table, 2 is matching IDs from the 2nd table and the difference is 2 which is the last two IDs are not in second table.
Is this doable in power bi?

Thanks in advance.

1 ACCEPTED SOLUTION
Kishore_KVN
Super User
Super User

Hello @P_P2595 
Create one column in Table 1 to get the matching records in Table 2 and its calculation looks as below:

Table 2 ID = LOOKUPVALUE('Table 2'[ID],'Table 2'[ID],'Table 1'[ID])

Output looks as below:

Kishore_KVN_0-1687861563540.png

Now create three measures as below:

Total ID's in Table 1 = COUNT('Table 1'[ID])
Matching with Table 2 = 
Var A = COUNT('Table 2'[ID])
Var B = COUNT('Table 1'[Table 2 ID])
Return
A-B
Difference = [Total ID's in Table 1] - [Matching with Table 2]

Drag all three into a table visual your output looks as below:

Kishore_KVN_1-1687861653258.png

 

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

View solution in original post

3 REPLIES 3
Kishore_KVN
Super User
Super User

Hello @P_P2595 
Create one column in Table 1 to get the matching records in Table 2 and its calculation looks as below:

Table 2 ID = LOOKUPVALUE('Table 2'[ID],'Table 2'[ID],'Table 1'[ID])

Output looks as below:

Kishore_KVN_0-1687861563540.png

Now create three measures as below:

Total ID's in Table 1 = COUNT('Table 1'[ID])
Matching with Table 2 = 
Var A = COUNT('Table 2'[ID])
Var B = COUNT('Table 1'[Table 2 ID])
Return
A-B
Difference = [Total ID's in Table 1] - [Matching with Table 2]

Drag all three into a table visual your output looks as below:

Kishore_KVN_1-1687861653258.png

 

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

@Kishore_KVN Thank you so much, It's work for me.😊

Anonymous
Not applicable

Hi @P_P2595 .

There are maybe several ways to create the desired output.

One way is to create the output table by
- selecting New table, from "Model view"
- Implementing DAX-logic to derive the following columns:
--- count of distinct id's in table 1   (e.g. 4)
--- count of distinct id's in both table 1 and 2 (e.g. 2)
--- Ids in table 1 but not in table 2 (e.g. 4-2=2)

Kind regards.

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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