Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gvg
Post Prodigy
Post Prodigy

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
MFelix
Super User
Super User

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

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
MFelix
Super User
Super User

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



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?

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



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

Thanks!

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



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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.