Skip to main content

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

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 schema details as below

Dataset format

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 calculated column in EmpTable, right click to data set name then click to New column.
Create new column in Power Bi


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

DAX Example

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:

DAX Output

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome

Comments

Popular posts from this blog

ALL DAX function

As it’s name suggests, Returns all the rows in a table, or all the values in a column.  ALL function removes the applied filters from the filter context. Its comes under Filter function DAX category.

LOOKUPVALUE DAX Function

Returns the value for the row that meets all criteria specified by search conditions. The function can apply one or more search conditions. Its comes under Filter function DAX category.