Forum Discussion

Raif8522's avatar
Raif8522
Frequent Visitor
3 years ago

Search Keyword from another Table and retrieve values

Hi Everyone,

 

i was trying to write a Dax formula to search a Keyword from Table B in "Comments" column on Table A and retrieve a "Date Open" & "Date Closed" values.

i tried to use  =Calculate(Firstnonblank([TableA],Filter([TableA],Search("Reference","Comments">0),ProductID))) but after SEARCH commend, "Reference" column is not available.

Table A    
Date OpenDate ClosedIncident IDProduct IDComments
01/11/202201/12/20222122*****20221101-212-Screen Error*****
10/09/202110/10/20222122*****20211009-212-NoPrint*****
01/01/2023 2151*****20230101-215-ResistorFailure*****
12/12/202214/12/20222173*****20221212-217-NoError******
01/07/202208/07/20222122*****20220701-212-Unknown*****

 

Table B   
Date OpenDate ClosedProduct IDReference
??21220221101-212-Screen Error
??21720221212-217-NoError
??21220220701-212-Unknown

 

 Anyone here can help me with the formula or if you think PowerQuery will be better?

 

Many Thanks in advance.

6 Replies

  • Raif8522 Hi! 

    So you want to search for a word from the Reference column of Table B in the Comments column of Table A then taking the respective Date Open and Closed?

     

    BBF

      • Raif8522's avatar
        Raif8522
        Frequent Visitor

        Sorry my bad, forgot to mention that *** are texts, basically it's comments from customers. But reference on the "comments" column Table A & text on the "Reference" column Table B are unique.

        I used SEARCH function to find the Reference in Comments column on Table A and retrieve Date Open & Date Closed values into Table B, but wasn't successful. 😕

    • Raif8522's avatar
      Raif8522
      Frequent Visitor

      Yes, that's correct. column "Comments" on Table B is a text field where **** represents texts. 

      i am going to check your solution below. 

      Much appreciated for your response.

       

      Thansk