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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JinjiNoDie
New Member

List missing information in new table

I have two tables with a M:M relationship. Whats the best way to determine if something is missing from the second table when comparing it to the first table? 

 

JinjiNoDie_0-1736269302273.png

 

1 ACCEPTED SOLUTION
rohit1991
Resolver IV
Resolver IV

To determine if something is missing in the second table compared to the first table in Power BI:

  1. Create Relationships: Establish a relationship between the two tables based on the common fields (e.g., Report Number and Item Number).

  2. Create a New Table: Use a DAX formula like the following to identify missing items:
    MissingItems =
    EXCEPT(
    SELECTCOLUMNS('FirstTable', "Report Number", 'FirstTable'[Report Number], "Item Number", 'FirstTable'[Item Number]),
    SELECTCOLUMNS('SecondTable', "Report Number", 'SecondTable'[Report Number], "Item Number", 'SecondTable'[Item Number]))

  3. Visualize the Output: Use a table visualization to display the MissingItems table, showing the Report Numbers and Item Numbers missing from the second table.

  4. This will directly list all missing combinations of report and item numbers.



View solution in original post

3 REPLIES 3
v-jtian-msft
Community Support
Community Support

Hello,rohit1991 ,thanks for your concern about this issue.

Your answer is excellent!
And I would like to share some additional solutions below.
Hi,@JinjiNoDie .I am glad to help you.
If your two tables are guaranteed to look up the same columns, then you can try creating a virtual table that contains all the data from the table by using the except function on both virtual tables
like this.

vjtianmsft_0-1736301448111.png

The EXCEPT function is mainly used to compare two tables and return the rows that exist in the first table but not in the second. Note that the two tables must have the same number of columns, and the order and data types of the columns must match.


Create two virtual tables, _table1 and _table2, containing the Report Number and Item Number columns in the FirstTable and SecondTable, respectively. Then, use the EXCEPT function to return the rows that are in _table1 but not in _table2.
This gives you the flexibility to perform data lookups on the original tables without affecting the structure and data of the original tables.
Below is my test data:

vjtianmsft_1-1736301507765.png

FirstTable

Report Number

Item Number

25-1

1001

25-1

1002

25-1

1004

25-2

1001

25-3

1002

25-3

1003

25-4

1101

25-4

1102


SecondTable

Report Number

Item Number

25-1

1001

25-4

1102

25-1

1004

25-2

1001

25-3

1002

25-3

1003

vjtianmsft_2-1736301544620.png

 


I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


 

rohit1991
Resolver IV
Resolver IV

To determine if something is missing in the second table compared to the first table in Power BI:

  1. Create Relationships: Establish a relationship between the two tables based on the common fields (e.g., Report Number and Item Number).

  2. Create a New Table: Use a DAX formula like the following to identify missing items:
    MissingItems =
    EXCEPT(
    SELECTCOLUMNS('FirstTable', "Report Number", 'FirstTable'[Report Number], "Item Number", 'FirstTable'[Item Number]),
    SELECTCOLUMNS('SecondTable', "Report Number", 'SecondTable'[Report Number], "Item Number", 'SecondTable'[Item Number]))

  3. Visualize the Output: Use a table visualization to display the MissingItems table, showing the Report Numbers and Item Numbers missing from the second table.

  4. This will directly list all missing combinations of report and item numbers.



This did it for me. Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.