Home » DAX » How to check table 1 value exist or not in table 2 without any relationship

How to check table 1 value exist or not in table 2 without any relationship

Check table 1 value exist or not in Table 2

In Power BI, how to check table 1 column values are exist in table 2 or not, when there is no relationship between both tables?



Dataset format :

Dataset -1

Requirement:

Check left table ID column values are exist in Right Table EmpId column or not, if exist then update flag value in Left table with 1 else 0.

Let’s start with an example:

Step-1: Create a calculated column in the “EmpTable,” right-click on the dataset name and then select “New Column.

New Column

New Column



Step-2: Write Dax formula to check column values are exist or not.

DAX IN DISTINCT

Flg =

IF ( EmpTable[ID] IN DISTINCT ( ProductOrder[EmpId]), 1, 0 )

So here, we used three DAX functions:- IF, DISTINCT & IN.

  • DISTINCT: Returns unique Empid values from ProductOrder table.
  • IN: It will check “EmpTable” ID column values are exist or not in ProductOrder Table.
  • IF: If Id’s are matched it will return 1 else 0.




Output :

Output-1

Output-1

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.



5 thoughts on “How to check table 1 value exist or not in table 2 without any relationship”

Leave a Reply