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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Henry44
Regular Visitor

If statement with two tables that are related

Hello

 

I have two tables that are related (they are related by a Job number)

 

Authority GIS (with a field called authority)  and SAW (with a field called Location_of_job)

 

I've been trying to do the following IF statement to create a new column with a job location.  I want a new column in the Authority table which contains the authority field value from Authority GIS if is not 'Not-recorded' but contains the Location_of_job value from the SAW table if it is 'Not-recorded'.  

 

Job_Location = IF(AUTHORITY <> "Not_recorded", AUTHORITY, Location_of_job) this isn't working and the error message is Cannot find name 'Location_of_job'

 

Any idea what I'm doing wrong?  Does this not work with two tables?

 

Thank you!

1 ACCEPTED SOLUTION
Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Henry44 ,
You must have the Job_location column in the Authority table. For this you can bring in this column from the SAW table using LOOKUPVALUE Function, and then try using the DAX (Job Location field must be from Authority table).
 

Create column in AUTHORITY:
Job_Location= LOOKUPVALUE(Location_of_Job, Authority(Job number), SAW(Job number))
Once this column is created, you can use your DAX:
Job_Location2 = IF(AUTHORITY <> "Not_recorded", AUTHORITY, Job_Location)

 

 

I hope this helps!

View solution in original post

2 REPLIES 2
Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Henry44 ,
You must have the Job_location column in the Authority table. For this you can bring in this column from the SAW table using LOOKUPVALUE Function, and then try using the DAX (Job Location field must be from Authority table).
 

Create column in AUTHORITY:
Job_Location= LOOKUPVALUE(Location_of_Job, Authority(Job number), SAW(Job number))
Once this column is created, you can use your DAX:
Job_Location2 = IF(AUTHORITY <> "Not_recorded", AUTHORITY, Job_Location)

 

 

I hope this helps!

Hi @Tanushree_Kapse 

 

Thank you so much, all sorted now.  😁

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.