Forum Discussion

dom-mitchell's avatar
dom-mitchell
Frequent Visitor
3 years ago

LOOKUPVALUE based on 2 variables issue

Hi all, 

 

I'm trying to get a value (Team) from one table (Team List) to pull through to a new column in a second table (Target List) based on two columns within both tables (Name and Month) which should match.

 

A rough sample of the data is as follows:

 

Team List

NameMonthTeam
RyanJan1
RyanFeb1
RyanMar1
RyanApr1
RyanMay1
RyanJun1
RyanJul2
RyanAug2
RyanSep2
RyanOct2
RyanNov2
RyanDec2

 

Target List

NameMonthTargetTeam
RyanJan10000 
RyanFeb10000 
RyanMar10000 
RyanApr10000 
RyanMay10000 
RyanJun10000 
RyanJul10000 
RyanAug10000 
RyanSep10000 
RyanOct10000 
RyanNov10000 
RyanDec10000 

 

I have tried the following DAX using the LOOKUPVALUEFUNCTION but, although doesn't return an error, isn't pulling through the correct data:

 

 

 

Team = LOOKUPVALUE('Team List'[Team],'Team List'[Name],[Name],'Team List'[Month],[Month])

 

 

 

That is giving me the result of:

Target List

NameMonthTargetTeam
RyanJan100001
RyanFeb100001
RyanMar100001
RyanApr100001
RyanMay100001
RyanJun100001
RyanJul100001
RyanAug100001
RyanSep100001
RyanOct100001
RyanNov100001
RyanDec100001

 

Why is it not picking up that Team should be '2' from July onwards? Very confused by this and not sure where I'm going wrong. 

9 Replies

  • sure I can try to look at it. 

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to 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.

     

  • dom-mitchell is there any relationship between these tables?

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to 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.

     

    • dom-mitchell's avatar
      dom-mitchell
      Frequent Visitor

      There is a relationship via third table which needs to be there to make soemthing else in the report work. 

  • dom-mitchell and if there is a relationship, delete the relationship and then it should work.

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to 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.

     

    • dom-mitchell's avatar
      dom-mitchell
      Frequent Visitor

      I've now tried it with no relationship between the tables and it still isn't pulling the values thorugh correctly. Same result as with the relationship. 

  • dom-mitchell what is that relationship? Is that relationship with both the tables? Please provide more details on the model, it is not something you are doing wrong using lookupvalue it is the relationship which is causing the issue and without having full details it is hard to provide any solution.

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to 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.

     

    • dom-mitchell's avatar
      dom-mitchell
      Frequent Visitor

      Thanks for the help so far parry2k .

       

      I've attached a screenshot of the relationship view. 

       

       

      I'm tempted to upload the pbix but it contains significant company data which is a worry for me to put up here. 

  • dom-mitchell I just did with your sample data and it works, see attached Power BI file.

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to 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.

     

     

    • dom-mitchell's avatar
      dom-mitchell
      Frequent Visitor

      Yeah, it looks to be the same as mine but for some reason, mine just doesn't pull the data through correctly. 

       

      Could I email you the PBIX? Don't really want to put it up here for download.