Forum Discussion

Mon_Go27's avatar
Mon_Go27
Frequent Visitor
3 years ago
Solved

LOOKUPVALUE not retrieving all the values

 Hi, I have two tables. KEYWORD REFERENCE table has a list of abbreviations (unique values) that are classified into different types. KEYWORDS table has a list of users that have been assigned one or more of the abbreviations from the KEYWORD REFERENCE table. I need to retrieve the abbreviation type in the KEYWORDS table. They look something like this:

 

KEYWORD REFERENCE

ABBREVIATIONTYPE
ABCTYPE 1
DEFTYPE 1
HIJTYPE 2
KLMTYPE 3
NOPTYPE 2
QRSTYPE 3

 

KEYWORDS

UIDABBREVIATIONTYPE
1ABC 
2ABC 
3KLM 
4KLM 
5KLM 
6DEF 

 

I have a many to one relationsheep between both tables, where the common value is the ABBREVIATION and I am trying to create a formula that will add the TYPE to my KEYWORDS table.

 

I have tried several options I have found in different tutorials; however, the problem is the same in all. The formula works but not for all of the values. Some of the rows are not getting a Type even when they have it in the KEYWORD REFERENCE table, and I am not sure why. I think it has something to do with the fact that my KEYWORDS table has duplicate values in the ABBREVIATIONS column; however, I have not found a way to make it work, as these values belong to a different user; therefore, they must stay like that. I have removed relationships, changed them to one to many and nothing fixes the problem. Can you help?

 

These are the formulas I have tried:

 

KEYWORD TYPE =
        VAR _type =
            LOOKUPVALUE('Keyword Reference'[type],'Keyword Reference'[abbreviation],Keywords[ABBREVIATION])

        VAR _nokeyword =
            LOOKUPVALUE(Keywords[ABBREVIATION],Keywords[ABBREVIATION],"NO KEYWORD")

        RETURN
        IF(Keywords[ABBREVIATION] = _nokeyword,"NO KEYWORD", _type)
 
***********************
TYPE = LOOKUPVALUE('Keyword Reference'[type],'Keyword Reference'[abbreviation],Keywords[ABBREVIATION])
 
************************
 
TYPE2 = CONCATENATEX(
       FILTER('Keyword Reference','Keyword Reference'[abbreviation] = Keywords[ABBREVIATION]),
       'Keyword Reference'[type])
 
************************
Thank you in advance.
  • Hi Mon_Go27 

     

    Download example PBIX file

     

    Why do you need to create a column in the Keywords table?  If you have a relationship between the two tables then the Type can be shown in a table visual when displaying the UID and Abbreviation from the Keyworsd table - see attached file.

     

     

    regards

     

    Phil

2 Replies

  • Hi Mon_Go27 

     

    Download example PBIX file

     

    Why do you need to create a column in the Keywords table?  If you have a relationship between the two tables then the Type can be shown in a table visual when displaying the UID and Abbreviation from the Keyworsd table - see attached file.

     

     

    regards

     

    Phil

    • Mon_Go27's avatar
      Mon_Go27
      Frequent Visitor

      Hi Phil,

       

      Thank you!

       

      You're right. I guess I was so focused on making it work that I forgot I was able to do it that way.

       

      I will do it like that. Thanks again! ๐Ÿ™‚