cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Partisan
Post Partisan

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Lookupvalue equivalent to search for text values

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

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Highlighted
Super User III
Super User III

Re: Lookupvalue equivalent to search for text values

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.

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Re: Lookupvalue equivalent to search for text values

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

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Highlighted
Post Partisan
Post Partisan

Re: Lookupvalue equivalent to search for text values

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?

Highlighted
Super User III
Super User III

Re: Lookupvalue equivalent to search for text values

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.

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Highlighted
Post Partisan
Post Partisan

Re: Lookupvalue equivalent to search for text values

OK, it works for a standalone measure. My problem was that I've been using it as part of another formula.

Thanks!

Highlighted
Super User III
Super User III

Re: Lookupvalue equivalent to search for text values

Hi @gvg,

 

This sould work even as part of another measure depending on the way you set up your measure.

 

Can you please elaborate how you are doing that?

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





Highlighted
Post Partisan
Post Partisan

Re: Lookupvalue equivalent to search for text values

Won't be able to reproduce it. I was experimenting with lots of solutions. 

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors