Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Unique ID Mismatch Detection

Hi guys,

 

There must be an obvious solution for this but maybe it is way more complicated than expected.

 

I have two tables linked by unique IDs such as : date + code + client name

 

Since both tables are normally updated everyday, everyday unique IDs are generated since the date changes (clarification, code + client name is itself always an unique combination)

 

However sometimes I do not have two files for the same date. In this scenario I need to ignore/delete the orphan rows; in order to get a clean relationship.

 

I guess this is something that has to be done on the Power Query Editor, or maybe with a DAX flag to detect IDs that do not match.

 

Any help would be much appreciated.

 

Thank you for your tips!

 

 

 

 

 

 

 

  • Hi Anonymous ,

     

    Sorry for our delay in response, We can create a new calculated table to connect table B with 1 to 1 relationship:

     

    New TableA = FILTER('TableA', var i = [ID] return CALCULATE(COUNTROWS('TableB'), 'TableB'[ID] = i)>0)

     


    If it doesn't meet your requirement, Could you please show the exact expected result based on the Tables that you have shared?

     

    By the way, PBIX file as attached.


    Best regards,

     

3 Replies

  • v-lid-msft's avatar
    v-lid-msft
    Community Support

    Hi Anonymous ,

     

    Sorry for that, but we cannot understand your data model clearly, Could you please provide a mockup sample  based on fake data or describe the fields of each tables and the relations between tables simply? It will be helpful if you can show us the exact expected result based on the tables. Please upload your files to OneDrive For Business and share the link here.

     

    What is the logic that you used to  delate rows, delete any rows that do not have a certain matched record in other table?

     

    Such as following sample should delete row 1 in table 1 and row no 2 in table 2?

     

    Table 1:

    Row No.

    Date

    Code

    Client name

    1

    2020-1-1

    1

    A

    2

    2020-2-1

    2

    B

    3

    2020-3-1

    3

    C

     

    Table 2:

    Row No.

    Date

    Code

    Client name

    1

    2020-2-1

    2

    B

    2

    2020-4-1

    1

    A

    3

    2020-3-1

    3

    C

     

     

    Please don't contain any Confidential Information or Real data in your reply.


    Best regards,

     

    • Anonymous's avatar
      Anonymous
      Not applicable
       

      Hello,

       

      Let's assume that left table is generally updated everyday, while right one not. In my report, the source for each table is a folder where new files are placed "periodically". In this example; we can see that records from 28/03/2020 are missing in the right table.

       

       

      1) So in this case, given a one-to-one relationship, I would like to delete (= avoid loading) those rows from Left Table, 28/03/2020.

       

      2) Alternatively I could create a calculated column to flag unmatched rows and the use it as an slicer (I guess).

       

      3) Another solution would be joining tables (inner join) but I would like to avoid that, assuming there is a better way to clean the data.

       

      Which one is the correct approach?

       

      Thank you.

       

       

       

      • v-lid-msft's avatar
        v-lid-msft
        Community Support

        Hi Anonymous ,

         

        Sorry for our delay in response, We can create a new calculated table to connect table B with 1 to 1 relationship:

         

        New TableA = FILTER('TableA', var i = [ID] return CALCULATE(COUNTROWS('TableB'), 'TableB'[ID] = i)>0)

         


        If it doesn't meet your requirement, Could you please show the exact expected result based on the Tables that you have shared?

         

        By the way, PBIX file as attached.


        Best regards,