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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.