Forum Discussion

sflynn's avatar
sflynn
Helper I
6 years ago

Create Dynamic Lookup between Unrelated tables

I have two data table, one with pricing listed out by tour and date (package price) and another data table with pricing listed out by airport and  date range (Air Price). There is currently no relationship between the tables as the relationship woud be many to many. I currenty have a formula in the in the package price table that returns the air rate for the corresponding tour and date. However, I need the formula to return air pricing based on a specific gateway as well as the tour and date. The package price table does not have any gateway information, but I did create a third table with just a list of airports. Is there any way to write a dax formula that would not only match the corresponding tour/date from the package price table but also the airport based on the filter selection from the list of airports?

5 Replies

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi sflynn ,

     

    You may create column or measure to get matched items using RELATED function, LOOKUPVALUE function, or FIRSTNONBLANK function .

     

    For example:

     

    Column1=RELATED([one side field of relationship])

     

    Column1= LOOKUPVALUE(tableA[goal field],  tableA[linked field],  tableB[linked field])) 

     

    Column1= CALCULATE (FIRSTNONBLANK ( tableA[goal field], 1 ),FILTER ( ALLSELECTED( tableA), tableA[linked field] = tableB[linked field] ))

     

    Or could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Thank you for your responces, please see the example snapshots of the data tables below: