Forum Discussion

GerbenvdHazel's avatar
6 years ago

Look up value between two dates from different table

Good day,

I have two tables.

One with trajectories with an end date.

The second table concerns relationships where persons working with a start and end date. The dates are not match exactly. Both tables have the same personal number.

I would like to have the company name from the second table.

 

A person can have different trajectories and different companies (history). I thougth about a between formula with datefilter and filter personal number. The end dates may differ.


link to file 

Hope to hear the solution
Thanks!

9 Replies

  • GerbenvdHazel is the 2nd table on 1 side of the relationship, if yes, then you can add column in 1st table like this

     

    Company = RELATED ( Table2[Company] )
    

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

    • GerbenvdHazel's avatar
      GerbenvdHazel
      Helper I

      A person can have different trajectories and different companies (history). I thougth about a between formula with datefilter and filter personal number

    • GerbenvdHazel's avatar
      GerbenvdHazel
      Helper I

      A person can have different trajectories and different companies (history). I thougth about a between formula with datefilter and filter personal number

      • v-deddai1-msft's avatar
        v-deddai1-msft
        Community Support

        Hi GerbenvdHazel ,

         

        You can add filter in LOOKUPVALUE function. But without sample data, it's difficult to provide a detailed formula.

        Would you please inform us more detailed information( your  data(by OneDrive for Business)) if possible? Then we will help you more correctly.

         

        Please do mask sensitive data before uploading.

         

        Thanks for your understanding and support.

         

        Best Regards,

        Dedmon Dai

  • RichardJ's avatar
    RichardJ
    Responsive Resident

    Hi GerbenvdHazel ,

     

    Depending on your data, the LOOKUP function would let you use the Personal Number from the first table to lookup the Personal Number on the Second table then return the value of the Company from the matching row on the second table to the first table.

     

    https://www.wallstreetmojo.com/power-bi-lookupvalue/

    https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax

     

    explains how it works.

     

    Hopefully this helps answer your question,

    Cheers,

    Richard