Forum Discussion

gvg's avatar
gvg
Icon for Post Prodigy rankPost Prodigy
9 years ago
Solved

Lookupvalue equivalent to search for text values

Hi DAXers,

I am wondering is there a way to search for a text string in DAX and return a value like with LOOKUPVALUE? I believe I can not use LOOKUPVALUE because ir requires a scalar search value. Looking for something like LOOKUPTEXT.

 

Thanks.

  • Hi gvg,

    Assuming you want to return the full data LOOKUPVALUE works fine with text if you only want part of tge value you need to use SEARCH.

    Regards,
    MFelix
  • Hi gvg,

    You are making a measure right? In dax you can use max and.min also with text fields, so if.ypu use the.last sintax should work.

6 Replies

  • Hi gvg,

    Assuming you want to return the full data LOOKUPVALUE works fine with text if you only want part of tge value you need to use SEARCH.

    Regards,
    MFelix
    • gvg's avatar
      gvg
      Icon for Post Prodigy rankPost Prodigy

      How does that work? Assume I have two tables:

       

      Table1                                                       Table2

      Product name   Amount                           Product name  Discount

      A                       100                                  A                       10%

      B                        200                                 B                        12%

       

      LOOKUPVALUE(Table1[Amount],Table1[Product name],Table2[Product name]) doesn't work for me complaining that the third argument needs to be scalar value. I need to write something like LOOKUPVALUE(Table1[Amount],Table1[Product name],MAX(Table2[Product name]) ), but this doesn't work either because Product name is not numeric field.  Am I loosing something here?

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User
        Hi gvg,

        You are making a measure right? In dax you can use max and.min also with text fields, so if.ypu use the.last sintax should work.