Forum Discussion
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).
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.
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 solution
I would be so grateful, if i can solve this.
probably in a more efficient way.
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])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.
5 Replies
- tamerj1Community Champion
Hi driplytics
What dax code did you use? which error did you get? which column connects the two tables?- driplyticsFrequent Visitor
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.Here are the connected column on both tables.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.- tamerj1Community Champion
driplytics
Please refer to sample file with the solution https://we.tl/t-GJkiT6Ovta