cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesBockett
Frequent Visitor

Calculated columns across tables

Hello

 

How do you do a 'not equal to' across tables?

 

I have 2 tables. Table 1 has columns: Unique ID, Field A & Field B.

Table 2 has Unique ID only. 

 

I need to create a column in Table 2 that returns "Pass" or Fail", depending on what is in Table 1, Field A and Field B. For example:

if Table 1[Field A] equals "1" or "2" or "3" or "4" and Table 1[Field B] does not equal "1" then "Fail"

OR

if Table 1[Field A] does not equal "1" or "2" or "3" or "4" and Table 1[Field B] does equal "1" then "Fail"

 

Thankful for any help

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Is this along the lines you're looking for?

Pass/Fail =
VAR A = LOOKUPVALUE ( Table1[FieldA], Table1[ID], Table2[ID] )
VAR B = LOOKUPVALUE ( Table1[FieldB], Table1[ID], Table2[ID] )
RETURN
    IF (
        ( A IN { "1", "2", "3", "4" } && B <> 1 ) ||
        ( NOT ( A IN { "1", "2", "3", "4" } ) && B = 1 ),
        "Fail",
        "Pass"
    )

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

Is this along the lines you're looking for?

Pass/Fail =
VAR A = LOOKUPVALUE ( Table1[FieldA], Table1[ID], Table2[ID] )
VAR B = LOOKUPVALUE ( Table1[FieldB], Table1[ID], Table2[ID] )
RETURN
    IF (
        ( A IN { "1", "2", "3", "4" } && B <> 1 ) ||
        ( NOT ( A IN { "1", "2", "3", "4" } ) && B = 1 ),
        "Fail",
        "Pass"
    )

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!