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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
driplytics
Frequent Visitor

Create a custom column with value from another table

Hi, i need help with this.

i have a flight data table with column name AirportFrom  and another AirportTo, columns has IATA code(Airport Code). 

Airport codes.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

my Goal is to show the Flight routes on a FLow map Visual.

To do this, i would like to use the Airport name instead of Airport Code. 

so, i overlayed a Dataset that has the Airportcode, Airport Names, Longitudes and Latitudes.

and Built a data Model with it.


Data model.png

 

 

 

 

 

 

 

 

 

 

then i tried to Create two custom columns named AirportOrigin and Airport Destination in the flight Dataset to retrieve the    Airport Names from the Overlayed table.

but i've got it all wrong with this.


My wrong solutionMy wrong solution

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I would be so grateful, if i can solve this. 

probably in a more efficient way. 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi, @driplytics 

Delete the relationship/add a new seperate table and then try calculated columns as below:

AirportOrigin = LOOKUPVALUE('Airport Data'[name],'Airport Data'[iata_code],'Dataset'[AirportFrom])
Airport Destination = LOOKUPVALUE('Airport Data'[name],'Airport Data'[iata_code],'Dataset'[AirportTo])

veasonfmsft_0-1657875757146.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @driplytics 
What dax code did you use? which error did you get? which column connects the two tables?

thank you @tamerj1 for ypur response.

Here's Dax i used to Create the 2 Custom columns

AirportOrigin = CALCULATE(
LOOKUPVALUE('Airport Data'[name],'Dataset'[AirportFrom],SELECTEDVALUE('Dataset'[AirportFrom]),
'Dataset'[AirportFrom])
Airport Destination = CALCULATE(LOOKUPVALUE('Airport Data'[name],'Dataset'[AirportTo],SELECTEDVALUE('Dataset'[AirportTo]),'Dataset'[AirportTo]))
 
 
This is the Error i got.
Error type.png
 
 
 
Here are the connected column on both tables.
linked columns.png
 
 
 
 
 
 
 
 
 
My Goal is to retrieve the Airport Name from the Airport Data and store it in a custom column created on the Dataset table. 
 
for Reference here's the link to my Datasets. 

@driplytics 
Please refer to sample file with the solution https://we.tl/t-GJkiT6Ovta

thanks @tamerj1 , i think you are close to the solution.

but instead of returning same Iata_code (Eg in the pics below, ATL is an Airport code), i want the name returned (Hartsfield Jackson Atlanta International Airport) on the custom columns.

 

what i got.png

 

 

 

 

 

 

 

 

 

 

 

expected result.png

Hi, @driplytics 

Delete the relationship/add a new seperate table and then try calculated columns as below:

AirportOrigin = LOOKUPVALUE('Airport Data'[name],'Airport Data'[iata_code],'Dataset'[AirportFrom])
Airport Destination = LOOKUPVALUE('Airport Data'[name],'Airport Data'[iata_code],'Dataset'[AirportTo])

veasonfmsft_0-1657875757146.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.